native.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright (C) 2006 Arkadiy Vertleyb
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_TYPEOF_NATIVE_HPP_INCLUDED
  5. #define BOOST_TYPEOF_NATIVE_HPP_INCLUDED
  6. #ifndef MSVC_TYPEOF_HACK
  7. #ifdef BOOST_NO_SFINAE
  8. namespace boost { namespace type_of {
  9. template<class T>
  10. T& ensure_obj(const T&);
  11. }}
  12. #else
  13. #include <boost/type_traits/enable_if.hpp>
  14. #include <boost/type_traits/is_function.hpp>
  15. namespace boost { namespace type_of {
  16. # ifdef BOOST_NO_SFINAE
  17. template<class T>
  18. T& ensure_obj(const T&);
  19. # else
  20. template<typename T>
  21. typename enable_if_<is_function<T>::value, T&>::type
  22. ensure_obj(T&);
  23. template<typename T>
  24. typename enable_if_<!is_function<T>::value, T&>::type
  25. ensure_obj(const T&);
  26. # endif
  27. }}
  28. #endif//BOOST_NO_SFINAE
  29. #define BOOST_TYPEOF(expr) BOOST_TYPEOF_KEYWORD(boost::type_of::ensure_obj(expr))
  30. #define BOOST_TYPEOF_TPL BOOST_TYPEOF
  31. #define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
  32. struct name {\
  33. typedef BOOST_TYPEOF_TPL(expr) type;\
  34. };
  35. #define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
  36. struct name {\
  37. typedef BOOST_TYPEOF(expr) type;\
  38. };
  39. #endif//MSVC_TYPEOF_HACK
  40. #define BOOST_TYPEOF_REGISTER_TYPE(x)
  41. #define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
  42. #endif//BOOST_TYPEOF_NATIVE_HPP_INCLUDED