File indexing completed on 2025-01-18 09:34:40
0001
0002
0003
0004
0005
0006
0007
0008
0009 #if !defined(BOOST_FUSION_FUNCTIONAL_INVOCATION_DETAIL_THAT_PTR_HPP_INCLUDED)
0010 #define BOOST_FUSION_FUNCTIONAL_INVOCATION_DETAIL_THAT_PTR_HPP_INCLUDED
0011
0012 #include <boost/fusion/support/config.hpp>
0013 #include <boost/get_pointer.hpp>
0014 #include <boost/utility/addressof.hpp>
0015 #include <boost/type_traits/remove_reference.hpp>
0016
0017 namespace boost { namespace fusion { namespace detail
0018 {
0019 template <typename Wanted>
0020 struct that_ptr
0021 {
0022 private:
0023
0024 typedef typename remove_reference<Wanted>::type pointee;
0025
0026 template <typename T>
0027 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0028 static inline pointee * do_get_pointer(T &, pointee * x)
0029 {
0030 return x;
0031 }
0032 template <typename T>
0033 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0034 static inline pointee * do_get_pointer(T & x, void const *)
0035 {
0036 return get_pointer(x);
0037 }
0038
0039 public:
0040
0041 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0042 static inline pointee * get(pointee * x)
0043 {
0044 return x;
0045 }
0046
0047 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0048 static inline pointee * get(pointee & x)
0049 {
0050 return boost::addressof(x);
0051 }
0052
0053 template <typename T>
0054 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0055 static inline pointee * get(T & x)
0056 {
0057 return do_get_pointer(x, boost::addressof(x));
0058 }
0059 };
0060
0061 template <typename PtrOrSmartPtr> struct non_const_pointee;
0062
0063 #if defined(BOOST_MSVC) || (defined(BOOST_BORLANDC) && !defined(BOOST_DISABLE_WIN32))
0064 # define BOOST_FUSION_TRAIT_DECL __cdecl
0065 #else
0066 # define BOOST_FUSION_TRAIT_DECL
0067 #endif
0068
0069 namespace adl_barrier
0070 {
0071 using boost::get_pointer;
0072 void const * BOOST_FUSION_TRAIT_DECL get_pointer(...);
0073
0074 template< typename T> char const_tester(T *);
0075 template< typename T> long const_tester(T const *);
0076
0077 template <typename Ptr>
0078 struct non_const_pointee_impl
0079 {
0080 static Ptr & what;
0081
0082 static bool const value =
0083 sizeof(const_tester(get_pointer(what))) == 1;
0084 };
0085 }
0086
0087 template <typename PtrOrSmartPtr> struct non_const_pointee
0088 : adl_barrier::non_const_pointee_impl<
0089 typename remove_cv<
0090 typename remove_reference<PtrOrSmartPtr>::type >::type >
0091 {
0092 typedef non_const_pointee type;
0093 typedef bool value_type;
0094 };
0095
0096 }}}
0097
0098 #endif
0099