Salome HOME
1af0acd1e9d345a482eeaf250a772e2e813d39d5
[tools/medcoupling.git] / src / INTERP_KERNEL / Bases / InterpKernelStlExt.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __INTERPKERNELSTLEXT_HXX__
21 #define __INTERPKERNELSTLEXT_HXX__
22
23 #include <functional>
24
25 namespace INTERP_KERNEL
26 {
27   namespace STLEXT
28   {
29     template<typename _Pair>
30     struct Select1st : public std::unary_function<_Pair, typename _Pair::first_type>
31     {
32       typename _Pair::first_type& operator()(_Pair& __x) const { return __x.first; }
33       const typename _Pair::first_type&operator()(const _Pair& __x) const { return __x.first; }
34     };
35
36     template<typename _T1, typename _T2>
37     inline void Construct(_T1* __p, const _T2& __value__) { ::new(static_cast<void*>(__p)) _T1(__value__); }
38
39     template<typename _Tp> inline void Destroy(_Tp* __pointer) { __pointer->~_Tp(); }
40   }
41 }
42
43 #endif