set.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. # include <boost/mpl/insert.hpp>
  9. # include <boost/mpl/set/set0.hpp>
  10. # include <boost/mpl/has_key.hpp>
  11. namespace boost { namespace parameter { namespace aux {
  12. typedef mpl::set0<> set0;
  13. template <class Set, class K>
  14. struct insert_
  15. {
  16. typedef typename mpl::insert<Set, K>::type type;
  17. };
  18. template <class Set, class K>
  19. struct has_key_
  20. {
  21. typedef typename mpl::has_key<Set, K>::type type;
  22. };
  23. }}} // namespace boost::parameter::aux
  24. # else
  25. # include <boost/mpl/list.hpp>
  26. # include <boost/mpl/end.hpp>
  27. # include <boost/mpl/find.hpp>
  28. # include <boost/mpl/not.hpp>
  29. # include <boost/mpl/push_front.hpp>
  30. namespace boost { namespace parameter { namespace aux {
  31. typedef mpl::list0<> set0;
  32. template <class Set, class K>
  33. struct insert_
  34. {
  35. typedef typename mpl::push_front<Set, K>::type type;
  36. };
  37. template <class Set, class K>
  38. struct has_key_
  39. {
  40. typedef typename mpl::find<Set, K>::type iter;
  41. typedef mpl::not_<
  42. is_same<iter, typename mpl::end<Set>::type>
  43. > type;
  44. };
  45. }}} // namespace boost::parameter::aux
  46. # endif
  47. #endif // BOOST_PARAMETER_SET_060912_HPP