set_value.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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_SET_VALUE_HPP_JOFA_100924
  9. #define BOOST_ICL_CONCEPT_SET_VALUE_HPP_JOFA_100924
  10. #include <boost/icl/type_traits/is_set.hpp>
  11. #include <boost/icl/type_traits/codomain_type_of.hpp>
  12. namespace boost{ namespace icl
  13. {
  14. //==============================================================================
  15. //= AlgoUnifiers<Set>
  16. //==============================================================================
  17. template<class Type, class Iterator>
  18. inline typename enable_if<is_set<Type>, const typename Type::key_type>::type&
  19. key_value(Iterator it_)
  20. {
  21. return *it_;
  22. }
  23. template<class Type>
  24. inline typename enable_if<is_set<Type>, typename Type::value_type>::type
  25. make_value(const typename Type::key_type& key_val,
  26. const typename codomain_type_of<Type>::type& )
  27. {
  28. return typename Type::value_type(key_val);
  29. }
  30. }} // namespace boost icl
  31. #endif