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_TYPE_TRAITS_ON_ABSORBTION_HPP_JOFA_100915 9 #define BOOST_ICL_TYPE_TRAITS_ON_ABSORBTION_HPP_JOFA_100915 10 11 namespace boost{ namespace icl 12 { 13 14 template<class Type, class Combiner, bool absorbs_identities> 15 struct on_absorbtion; 16 17 template<class Type, class Combiner> 18 struct on_absorbtion<Type, Combiner, false> 19 { 20 typedef on_absorbtion type; 21 typedef typename Type::codomain_type codomain_type; 22 is_absorbableboost::icl::on_absorbtion23 static bool is_absorbable(const codomain_type&){ return false; } 24 }; 25 26 template<class Type, class Combiner> 27 struct on_absorbtion<Type, Combiner, true> 28 { 29 typedef on_absorbtion type; 30 typedef typename Type::codomain_type codomain_type; 31 typedef typename Type::codomain_combine codomain_combine; 32 is_absorbableboost::icl::on_absorbtion33 static bool is_absorbable(const codomain_type& co_value) 34 { 35 return co_value == Combiner::identity_element(); 36 } 37 }; 38 39 }} // namespace boost icl 40 41 #endif 42 43 44