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_TEST_PORTABILITY_HPP_JOFA_101111
9 #define BOOST_ICL_TEST_PORTABILITY_HPP_JOFA_101111
10 
11 #include <boost/icl/detail/design_config.hpp>
12 
13 // This file contains auxiliary macros to help with portability problems
14 // It is not designed to for general use but only in the context of test
15 // code for the ICL. There will be a number of specific assumptions about
16 // e.g. template parameter names that are only valid for icl tests.
17 
18 //PORT: msvc-7.1: For local template template parameters, msvc-7.1 does not
19 // accept a subsequent instantiation of that parameter using default arguments e.g.:
20 // test_functions.hpp(37) : error C2976: 'IntervalMap' : too few template arguments
21 
22 //ASSUMPTION: Fixed name IntervalMap
23 #define ICL_PORT_msvc_7_1_IntervalMap(tp_T, tp_U, tp_Trt) \
24 IntervalMap<tp_T, tp_U, tp_Trt \
25            ,ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, tp_T) \
26            ,ICL_COMBINE_INSTANCE(icl::inplace_plus, tp_U) \
27            ,ICL_SECTION_INSTANCE(icl::inter_section, tp_U) \
28            ,ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, tp_T, ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, tp_T)) \
29            ,std::allocator>
30 
31 //ASSUMPTION: Fixed name IntervalSet
32 #define ICL_PORT_msvc_7_1_IntervalSet(tp_T) \
33 IntervalSet<tp_T \
34            ,ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, tp_T) \
35            ,ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, tp_T, ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, tp_T)) \
36            ,std::allocator>
37 
38 
39 //------------------------------------------------------------------------------
40 // Signature Macros: Help reducing redundancies in template headers
41 //------------------------------------------------------------------------------
42 #define ICL_IntervalMap_TEMPLATE(tp_T, tp_U, tp_Traits, tp_Trt) \
43 template<class tp_T, class tp_U, \
44        class tp_Traits = tp_Trt, \
45        ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, tp_T), \
46        ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, tp_U), \
47        ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, tp_U), \
48        ICL_INTERVAL(ICL_COMPARE)  Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, tp_T, Compare), \
49        ICL_ALLOC   Alloc   = std::allocator>class
50 
51 
52 #ifndef ICL_INTERVAL_BITSET_IMPL
53 
54 #   define ICL_IntervalSet_TEMPLATE(tp_T) \
55     template<class tp_T, \
56         ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, tp_T), \
57         ICL_INTERVAL(ICL_COMPARE)  Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, tp_T, Compare), \
58         ICL_ALLOC   Alloc   = std::allocator>class
59 
60 #else
61 
62 #   define ICL_IntervalSet_TEMPLATE(tp_T) \
63     template<class tp_T, \
64         class BitSetT = icl::bits<unsigned long>, \
65         ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, tp_T), \
66         ICL_INTERVAL(ICL_COMPARE)  Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, tp_T, Compare), \
67         ICL_ALLOC   Alloc   = std::allocator>class
68 
69 #endif //ICL_INTERVAL_BITSET_IMPL
70 
71 #endif // BOOST_ICL_TEST_PORTABILITY_HPP_JOFA_101111
72