template_keyword.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright Daniel Wallin 2006. Use, modification and distribution is
  2. // subject to the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
  5. # define BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
  6. # include <boost/mpl/and.hpp>
  7. # include <boost/mpl/not.hpp>
  8. # include <boost/type_traits/is_convertible.hpp>
  9. # include <boost/type_traits/is_reference.hpp>
  10. namespace boost { namespace parameter {
  11. namespace aux
  12. {
  13. struct template_keyword_tag {};
  14. template <class T, class U>
  15. struct is_pointer_convertible
  16. : is_convertible<T*, U*>
  17. {};
  18. template <class T>
  19. struct is_template_keyword
  20. : mpl::and_<
  21. mpl::not_<is_reference<T> >
  22. , is_pointer_convertible<T, template_keyword_tag>
  23. >
  24. {};
  25. } // namespace aux
  26. template <class Tag, class T>
  27. struct template_keyword
  28. : aux::template_keyword_tag
  29. {
  30. typedef Tag key_type;
  31. typedef T value_type;
  32. typedef value_type reference;
  33. };
  34. }} // namespace boost::parameter
  35. #endif // BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP