set.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_SET_060912_HPP
  5. # define BOOST_PARAMETER_SET_060912_HPP
  6. # include <boost/detail/workaround.hpp>
  7. # if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
  8. && !BOOST_WORKAROUND(__GNUC__, < 3)
  9. # include <boost/mpl/insert.hpp>
  10. # include <boost/mpl/set/set0.hpp>
  11. # include <boost/mpl/has_key.hpp>
  12. namespace boost { namespace parameter { namespace aux {
  13. typedef mpl::set0<> set0;
  14. template <class Set, class K>
  15. struct insert_
  16. {
  17. typedef typename mpl::insert<Set, K>::type type;
  18. };
  19. template <class Set, class K>
  20. struct has_key_
  21. {
  22. typedef typename mpl::has_key<Set, K>::type type;
  23. };
  24. }}} // namespace boost::parameter::aux
  25. # else
  26. # include <boost/mpl/list.hpp>
  27. # include <boost/mpl/end.hpp>
  28. # include <boost/mpl/find.hpp>
  29. # include <boost/mpl/not.hpp>
  30. # include <boost/mpl/push_front.hpp>
  31. namespace boost { namespace parameter { namespace aux {
  32. typedef mpl::list0<> set0;
  33. template <class Set, class K>
  34. struct insert_
  35. {
  36. typedef typename mpl::push_front<Set, K>::type type;
  37. };
  38. template <class Set, class K>
  39. struct has_key_
  40. {
  41. typedef typename mpl::find<Set, K>::type iter;
  42. typedef mpl::not_<
  43. is_same<iter, typename mpl::end<Set>::type>
  44. > type;
  45. };
  46. }}} // namespace boost::parameter::aux
  47. # endif
  48. #endif // BOOST_PARAMETER_SET_060912_HPP