is_placeholder.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
  2. #define BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2001-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/arg_fwd.hpp>
  14. #include <boost/mpl/bool.hpp>
  15. #include <boost/mpl/aux_/yes_no.hpp>
  16. #include <boost/mpl/aux_/type_wrapper.hpp>
  17. #include <boost/mpl/aux_/nttp_decl.hpp>
  18. #include <boost/mpl/aux_/config/ctps.hpp>
  19. #include <boost/mpl/aux_/config/static_constant.hpp>
  20. namespace boost { namespace mpl {
  21. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  22. template< typename T >
  23. struct is_placeholder
  24. : bool_<false>
  25. {
  26. };
  27. template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
  28. struct is_placeholder< arg<N> >
  29. : bool_<true>
  30. {
  31. };
  32. #else
  33. namespace aux {
  34. aux::no_tag is_placeholder_helper(...);
  35. template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
  36. aux::yes_tag is_placeholder_helper(aux::type_wrapper< arg<N> >*);
  37. } // namespace aux
  38. template< typename T >
  39. struct is_placeholder
  40. {
  41. static aux::type_wrapper<T>* get();
  42. BOOST_STATIC_CONSTANT(bool, value =
  43. sizeof(aux::is_placeholder_helper(get())) == sizeof(aux::yes_tag)
  44. );
  45. typedef bool_<value> type;
  46. };
  47. #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  48. }}
  49. #endif // BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED