|
Lines 59-64
Link Here
|
| 59 |
#if defined(G4USE_STD11) || defined(G4USE_STD14) |
59 |
#if defined(G4USE_STD11) || defined(G4USE_STD14) |
| 60 |
#include <type_traits> |
60 |
#include <type_traits> |
| 61 |
using std::remove_reference; |
61 |
using std::remove_reference; |
|
|
62 |
using std::remove_const; |
| 62 |
// original usage below in G4AnyMethod (pre C++11) was without namespace std:: |
63 |
// original usage below in G4AnyMethod (pre C++11) was without namespace std:: |
| 63 |
// so if compiler has them, make them available without the namespace |
64 |
// so if compiler has them, make them available without the namespace |
| 64 |
#else |
65 |
#else |
|
Lines 70-76
Link Here
|
| 70 |
// (i.e. avoid "using namespace std") |
71 |
// (i.e. avoid "using namespace std") |
| 71 |
template<typename T> struct remove_reference {typedef T type;}; |
72 |
template<typename T> struct remove_reference {typedef T type;}; |
| 72 |
template<typename T> struct remove_reference<T&> {typedef T type;}; |
73 |
template<typename T> struct remove_reference<T&> {typedef T type;}; |
| 73 |
template<typename T> struct remove_reference<const T&> {typedef T type;}; |
74 |
template<typename T> struct remove_const {typedef T type;}; |
|
|
75 |
template<typename T> struct remove_const<const T> {typedef T type;}; |
| 74 |
#endif |
76 |
#endif |
| 75 |
|
77 |
|
| 76 |
/** |
78 |
/** |
|
Lines 172-178
Link Here
|
| 172 |
}; |
174 |
}; |
| 173 |
|
175 |
|
| 174 |
template <class S, class T, class A0> struct FuncRef1: public Placeholder { |
176 |
template <class S, class T, class A0> struct FuncRef1: public Placeholder { |
| 175 |
typedef typename remove_reference<A0>::type nakedA0; |
177 |
typedef typename remove_const<typename remove_reference<A0>::type>::type nakedA0; |
| 176 |
|
178 |
|
| 177 |
FuncRef1(S (T::*f)(A0)) : fRef(f) {} |
179 |
FuncRef1(S (T::*f)(A0)) : fRef(f) {} |
| 178 |
|
180 |
|
|
Lines 195-203
Link Here
|
| 195 |
}; |
197 |
}; |
| 196 |
|
198 |
|
| 197 |
template <class S, class T, class A0, class A1> struct FuncRef2: public Placeholder { |
199 |
template <class S, class T, class A0, class A1> struct FuncRef2: public Placeholder { |
| 198 |
typedef typename remove_reference<A0>::type nakedA0; |
200 |
typedef typename remove_const<typename remove_reference<A0>::type>::type nakedA0; |
| 199 |
typedef typename remove_reference<A1>::type nakedA1; |
201 |
typedef typename remove_const<typename remove_reference<A1>::type>::type nakedA1; |
| 200 |
|
202 |
|
| 201 |
FuncRef2(S (T::*f)(A0, A1)) : fRef(f) {} |
203 |
FuncRef2(S (T::*f)(A0, A1)) : fRef(f) {} |
| 202 |
|
204 |
|
| 203 |
virtual void operator()(void*) { |
205 |
virtual void operator()(void*) { |