annotate DEPENDENCIES/generic/include/boost/icl/concept/map_value.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
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_MAP_VALUE_HPP_JOFA_100924
Chris@16 9 #define BOOST_ICL_CONCEPT_MAP_VALUE_HPP_JOFA_100924
Chris@16 10
Chris@16 11 #include <boost/icl/type_traits/predicate.hpp>
Chris@16 12 #include <boost/icl/type_traits/identity_element.hpp>
Chris@16 13 #include <boost/icl/type_traits/is_map.hpp>
Chris@16 14
Chris@16 15 namespace boost{ namespace icl
Chris@16 16 {
Chris@16 17
Chris@16 18 //==============================================================================
Chris@16 19 //= AlgoUnifiers<Map>
Chris@16 20 //==============================================================================
Chris@16 21 template<class Type, class Iterator>
Chris@16 22 inline typename enable_if<is_map<Type>, const typename Type::key_type>::type&
Chris@16 23 key_value(Iterator it_)
Chris@16 24 {
Chris@16 25 return (*it_).first;
Chris@16 26 }
Chris@16 27
Chris@16 28 template<class Type, class Iterator>
Chris@16 29 inline typename enable_if<is_map<Type>, const typename Type::codomain_type>::type&
Chris@16 30 co_value(Iterator it_)
Chris@16 31 {
Chris@16 32 return (*it_).second;
Chris@16 33 }
Chris@16 34
Chris@16 35 template<class Type>
Chris@16 36 inline typename enable_if<is_map<Type>, typename Type::value_type>::type
Chris@16 37 make_value(const typename Type:: key_type& key_val,
Chris@16 38 const typename Type::codomain_type& co_val)
Chris@16 39 {
Chris@16 40 return typename Type::value_type(key_val, co_val);
Chris@16 41 }
Chris@16 42
Chris@16 43
Chris@16 44 template <class Type>
Chris@16 45 class content_is_identity_element: public property<Type>
Chris@16 46 {
Chris@16 47 public:
Chris@16 48 bool operator() (const Type& value_pair)const
Chris@16 49 {
Chris@16 50 return value_pair.second
Chris@16 51 == identity_element<typename Type::second_type>::value();
Chris@16 52 }
Chris@16 53 } ;
Chris@16 54
Chris@16 55
Chris@16 56
Chris@16 57 }} // namespace boost icl
Chris@16 58
Chris@16 59 #endif
Chris@16 60
Chris@16 61