is_lvalue_reference.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes,
  2. // Howard Hinnant and John Maddock 2000.
  3. // (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001
  4. // Use, modification and distribution are subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt).
  7. //
  8. // See http://www.boost.org/libs/type_traits for most recent version including documentation.
  9. // Fixed is_pointer, is_lvalue_reference, is_const, is_volatile, is_same,
  10. // is_member_pointer based on the Simulated Partial Specialization work
  11. // of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or
  12. // http://groups.yahoo.com/group/boost/message/5441
  13. // Some workarounds in here use ideas suggested from "Generic<Programming>:
  14. // Mappings between Types and Values"
  15. // by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html).
  16. #ifndef BOOST_TT_IS_LVALUE_REFERENCE_HPP_INCLUDED
  17. #define BOOST_TT_IS_LVALUE_REFERENCE_HPP_INCLUDED
  18. #include <boost/type_traits/integral_constant.hpp>
  19. namespace boost {
  20. #if defined( __CODEGEARC__ )
  21. template <class T> struct is_lvalue_reference : public integral_constant<bool, __is_reference(T)>{};
  22. #else
  23. template <class T> struct is_lvalue_reference : public false_type{};
  24. template <class T> struct is_lvalue_reference<T&> : public true_type{};
  25. #if defined(BOOST_ILLEGAL_CV_REFERENCES)
  26. // these are illegal specialisations; cv-qualifies applied to
  27. // references have no effect according to [8.3.2p1],
  28. // C++ Builder requires them though as it treats cv-qualified
  29. // references as distinct types...
  30. template <class T> struct is_lvalue_reference<T&const> : public true_type{};
  31. template <class T> struct is_lvalue_reference<T&volatile> : public true_type{};
  32. template <class T> struct is_lvalue_reference<T&const volatile> : public true_type{};
  33. #endif
  34. #endif
  35. } // namespace boost
  36. #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED