portability.hpp 3.4 KB

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