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