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_INTERVAL_TRAITS_HPP_JOFA_100926
|
Chris@16
|
9 #define BOOST_ICL_INTERVAL_TRAITS_HPP_JOFA_100926
|
Chris@16
|
10
|
Chris@16
|
11 #include <boost/icl/type_traits/domain_type_of.hpp>
|
Chris@16
|
12 #include <boost/icl/type_traits/difference_type_of.hpp>
|
Chris@16
|
13 #include <boost/icl/type_traits/size_type_of.hpp>
|
Chris@16
|
14
|
Chris@16
|
15 namespace boost{ namespace icl
|
Chris@16
|
16 {
|
Chris@16
|
17
|
Chris@16
|
18 template<class Type> struct interval_traits;
|
Chris@16
|
19
|
Chris@16
|
20 template<class Type>
|
Chris@16
|
21 struct domain_type_of<interval_traits<Type> >
|
Chris@16
|
22 {
|
Chris@16
|
23 typedef typename interval_traits<Type>::domain_type type;
|
Chris@16
|
24 };
|
Chris@16
|
25
|
Chris@16
|
26 //------------------------------------------------------------------------------
|
Chris@16
|
27 //- Adapter class
|
Chris@16
|
28 //------------------------------------------------------------------------------
|
Chris@16
|
29 template<class Type> struct interval_traits
|
Chris@16
|
30 {
|
Chris@16
|
31 typedef interval_traits type;
|
Chris@16
|
32 typedef typename domain_type_of<Type>::type domain_type;
|
Chris@16
|
33
|
Chris@16
|
34 static Type construct(const domain_type& lo, const domain_type& up);
|
Chris@16
|
35
|
Chris@16
|
36 static domain_type upper(const Type& inter_val);
|
Chris@16
|
37 static domain_type lower(const Type& inter_val);
|
Chris@16
|
38 };
|
Chris@16
|
39
|
Chris@16
|
40 template<class Type>
|
Chris@16
|
41 struct difference_type_of<interval_traits<Type> >
|
Chris@16
|
42 {
|
Chris@16
|
43 typedef typename interval_traits<Type>::domain_type domain_type;
|
Chris@16
|
44 typedef typename difference_type_of<domain_type>::type type;
|
Chris@16
|
45 };
|
Chris@16
|
46
|
Chris@16
|
47 template<class Type>
|
Chris@16
|
48 struct size_type_of<interval_traits<Type> >
|
Chris@16
|
49 {
|
Chris@16
|
50 typedef typename interval_traits<Type>::domain_type domain_type;
|
Chris@16
|
51 typedef typename size_type_of<domain_type>::type type;
|
Chris@16
|
52 };
|
Chris@16
|
53
|
Chris@16
|
54 }} // namespace boost icl
|
Chris@16
|
55
|
Chris@16
|
56 #endif
|
Chris@16
|
57
|
Chris@16
|
58
|