same_as.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef BOOST_MPL_SAME_AS_HPP_INCLUDED
  2. #define BOOST_MPL_SAME_AS_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/not.hpp>
  14. #include <boost/mpl/aux_/lambda_spec.hpp>
  15. #include <boost/mpl/aux_/config/forwarding.hpp>
  16. #include <boost/type_traits/is_same.hpp>
  17. namespace boost { namespace mpl {
  18. template< typename T1 >
  19. struct same_as
  20. {
  21. template< typename T2 > struct apply
  22. #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
  23. : is_same<T1,T2>
  24. {
  25. #else
  26. {
  27. typedef typename is_same<T1,T2>::type type;
  28. #endif
  29. };
  30. };
  31. template< typename T1 >
  32. struct not_same_as
  33. {
  34. template< typename T2 > struct apply
  35. #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
  36. : not_< is_same<T1,T2> >
  37. {
  38. #else
  39. {
  40. typedef typename not_< is_same<T1,T2> >::type type;
  41. #endif
  42. };
  43. };
  44. }}
  45. #endif // BOOST_MPL_SAME_AS_HPP_INCLUDED