is_element_container.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*-----------------------------------------------------------------------------+
  2. Copyright (c) 2008-2009: Joachim Faulhaber
  3. +------------------------------------------------------------------------------+
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENCE.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. +-----------------------------------------------------------------------------*/
  8. #ifndef BOOST_ICL_TYPE_TRAITS_IS_ELEMENT_CONTAINER_HPP_JOFA_090830
  9. #define BOOST_ICL_TYPE_TRAITS_IS_ELEMENT_CONTAINER_HPP_JOFA_090830
  10. #include <boost/mpl/and.hpp>
  11. #include <boost/mpl/or.hpp>
  12. #include <boost/mpl/not.hpp>
  13. #include <boost/icl/type_traits/is_container.hpp>
  14. #include <boost/icl/type_traits/is_interval_container.hpp>
  15. #include <boost/icl/type_traits/is_set.hpp>
  16. namespace boost{ namespace icl
  17. {
  18. template<class Type>
  19. struct is_element_map
  20. {
  21. typedef is_element_map<Type> type;
  22. BOOST_STATIC_CONSTANT(bool, value =
  23. (mpl::and_<is_map<Type>, mpl::not_<is_interval_container<Type> > >::value)
  24. );
  25. };
  26. template<class Type>
  27. struct is_element_set
  28. {
  29. typedef is_element_set<Type> type;
  30. BOOST_STATIC_CONSTANT(bool, value =
  31. (mpl::or_< mpl::and_< is_set<Type>
  32. , mpl::not_<is_interval_container<Type> > >
  33. , is_std_set<Type>
  34. >::value)
  35. );
  36. };
  37. template <class Type>
  38. struct is_element_container
  39. {
  40. typedef is_element_container<Type> type;
  41. BOOST_STATIC_CONSTANT(bool, value =
  42. (mpl::or_<is_element_set<Type>, is_element_map<Type> >::value)
  43. );
  44. };
  45. }} // namespace boost icl
  46. #endif