joinable.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*-----------------------------------------------------------------------------+
  2. Copyright (c) 2010-2010: 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_CONCEPT_JOINABLE_HPP_JOFA_100920
  9. #define BOOST_ICL_CONCEPT_JOINABLE_HPP_JOFA_100920
  10. #include <boost/icl/type_traits/is_interval_container.hpp>
  11. #include <boost/icl/concept/interval.hpp>
  12. namespace boost{ namespace icl
  13. {
  14. namespace segmental
  15. {
  16. template<class Type>
  17. typename enable_if<is_interval_set<Type>, bool>::type
  18. is_joinable(typename Type::iterator it_, typename Type::iterator next_, Type* = 0)
  19. {
  20. return touches(*it_, *next_);
  21. }
  22. template<class Type>
  23. typename enable_if<is_interval_map<Type>, bool>::type
  24. is_joinable(typename Type::iterator it_, typename Type::iterator next_, Type* = 0)
  25. {
  26. return touches((*it_).first, (*next_).first)
  27. && (*it_).second == (*next_).second ;
  28. }
  29. }
  30. }} // namespace boost icl
  31. #endif