Chris@16
|
1 /*-----------------------------------------------------------------------------+
|
Chris@16
|
2 Copyright (c) 2010-2010: Joachim Faulhaber
|
Chris@16
|
3 +------------------------------------------------------------------------------+
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
5 (See accompanying file LICENCE.txt or copy at
|
Chris@16
|
6 http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7 +-----------------------------------------------------------------------------*/
|
Chris@16
|
8 #ifndef BOOST_ICL_CONCEPT_SET_VALUE_HPP_JOFA_100924
|
Chris@16
|
9 #define BOOST_ICL_CONCEPT_SET_VALUE_HPP_JOFA_100924
|
Chris@16
|
10
|
Chris@16
|
11 #include <boost/icl/type_traits/is_set.hpp>
|
Chris@16
|
12 #include <boost/icl/type_traits/codomain_type_of.hpp>
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost{ namespace icl
|
Chris@16
|
15 {
|
Chris@16
|
16
|
Chris@16
|
17 //==============================================================================
|
Chris@16
|
18 //= AlgoUnifiers<Set>
|
Chris@16
|
19 //==============================================================================
|
Chris@16
|
20 template<class Type, class Iterator>
|
Chris@16
|
21 inline typename enable_if<is_set<Type>, const typename Type::key_type>::type&
|
Chris@16
|
22 key_value(Iterator it_)
|
Chris@16
|
23 {
|
Chris@16
|
24 return *it_;
|
Chris@16
|
25 }
|
Chris@16
|
26
|
Chris@16
|
27 template<class Type>
|
Chris@16
|
28 inline typename enable_if<is_set<Type>, typename Type::value_type>::type
|
Chris@16
|
29 make_value(const typename Type::key_type& key_val,
|
Chris@16
|
30 const typename codomain_type_of<Type>::type& )
|
Chris@16
|
31 {
|
Chris@16
|
32 return typename Type::value_type(key_val);
|
Chris@16
|
33 }
|
Chris@16
|
34
|
Chris@16
|
35
|
Chris@16
|
36 }} // namespace boost icl
|
Chris@16
|
37
|
Chris@16
|
38 #endif
|
Chris@16
|
39
|
Chris@16
|
40
|