design_config.hpp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*-----------------------------------------------------------------------------+
  2. Author: Joachim Faulhaber
  3. Copyright (c) 2009-2010: Joachim Faulhaber
  4. +------------------------------------------------------------------------------+
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENCE.txt or copy at
  7. http://www.boost.org/LICENSE_1_0.txt)
  8. +-----------------------------------------------------------------------------*/
  9. /*-----------------------------------------------------------------------------+
  10. Template parameters of major itl class templates can be designed as
  11. template template parameters or
  12. template type parameter
  13. by setting defines in this file.
  14. +-----------------------------------------------------------------------------*/
  15. #ifndef BOOST_ICL_DESIGN_CONFIG_HPP_JOFA_090214
  16. #define BOOST_ICL_DESIGN_CONFIG_HPP_JOFA_090214
  17. // If this macro is defined, right_open_interval with static interval borders
  18. // will be used as default for all interval containers.
  19. // BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS should be defined in the application
  20. // before other includes from the ITL
  21. //#define BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS
  22. // If BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS is NOT defined, ITL uses intervals
  23. // with dynamic borders as default.
  24. //------------------------------------------------------------------------------
  25. // Auxiliary macros for denoting template signatures.
  26. // Purpose:
  27. // (1) Shorten the lenthy and redundant template signatures.
  28. // (2) Name anonymous template types according to their meaning ...
  29. // (3) Making easier to refactor by redefinitin of the macros
  30. // (4) Being able to check template template parameter variants against
  31. // template type parameter variants.
  32. #define ICL_USE_COMPARE_TEMPLATE_TEMPLATE
  33. #define ICL_USE_COMBINE_TEMPLATE_TEMPLATE
  34. #define ICL_USE_SECTION_TEMPLATE_TEMPLATE
  35. // ICL_USE_INTERVAL_TEMPLATE_TYPE
  36. //------------------------------------------------------------------------------
  37. // template parameter Compare can not be a template type parameter as long as
  38. // Compare<Interval<DomainT,Compare> >() is called in std::lexicographical_compare
  39. // implementing operator< for interval_base_{set,map}. see NOTE DESIGN TTP
  40. #ifdef ICL_USE_COMPARE_TEMPLATE_TEMPLATE
  41. # define ICL_COMPARE template<class>class
  42. # define ICL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare<domain_type>
  43. # define ICL_COMPARE_INSTANCE(compare_instance, domain_type) compare_instance
  44. # define ICL_EXCLUSIVE_LESS(interval_type) exclusive_less_than
  45. #else//ICL_USE_COMPARE_TEMPLATE_TYPE
  46. # define ICL_COMPARE class
  47. # define ICL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare
  48. # define ICL_COMPARE_INSTANCE(compare_instance, domain_type) compare_instance<domain_type>
  49. # define ICL_EXCLUSIVE_LESS(interval_type) exclusive_less_than<interval_type>
  50. #endif
  51. //------------------------------------------------------------------------------
  52. // template parameter Combine could be a template type parameter.
  53. #ifdef ICL_USE_COMBINE_TEMPLATE_TEMPLATE
  54. # define ICL_COMBINE template<class>class
  55. # define ICL_COMBINE_CODOMAIN(itl_combine, codomain_type) itl_combine<codomain_type>
  56. # define ICL_COMBINE_INSTANCE(combine_instance,codomain_type) combine_instance
  57. #else//ICL_USE_COMBINE_TEMPLATE_TYPE
  58. # define ICL_COMBINE class
  59. # define ICL_COMBINE_CODOMAIN(itl_combine, codomain_type) itl_combine
  60. # define ICL_COMBINE_INSTANCE(combine_instance,codomain_type) combine_instance<codomain_type>
  61. #endif
  62. //------------------------------------------------------------------------------
  63. // template parameter Section could be a template type parameter.
  64. #ifdef ICL_USE_SECTION_TEMPLATE_TEMPLATE
  65. # define ICL_SECTION template<class>class
  66. # define ICL_SECTION_CODOMAIN(itl_intersect, codomain_type) itl_intersect<codomain_type>
  67. # define ICL_SECTION_INSTANCE(section_instance,codomain_type) section_instance
  68. #else//ICL_USE_SECTION_TEMPLATE_TYPE
  69. # define ICL_SECTION class
  70. # define ICL_SECTION_CODOMAIN(itl_intersect, codomain_type) itl_intersect
  71. # define ICL_SECTION_INSTANCE(section_instance,codomain_type) section_instance<codomain_type>
  72. #endif
  73. //------------------------------------------------------------------------------
  74. // template parameter Interval could be a template type parameter.
  75. #ifdef ICL_USE_INTERVAL_TEMPLATE_TEMPLATE
  76. # define ICL_INTERVAL(itl_compare) template<class,itl_compare>class
  77. # define ICL_INTERVAL2(itl_compare) template<class DomT2,itl_compare>class
  78. # define ICL_INTERVAL_TYPE(itl_interval, domain_type, itl_compare) itl_interval<domain_type,itl_compare>
  79. # define ICL_INTERVAL_INSTANCE(interval_instance,domain_type,itl_compare) interval_instance
  80. #else//ICL_USE_INTERVAL_TEMPLATE_TYPE
  81. # define ICL_INTERVAL(itl_compare) class
  82. # define ICL_INTERVAL2(itl_compare) class
  83. # define ICL_INTERVAL_TYPE(itl_interval, domain_type, itl_compare) itl_interval
  84. # define ICL_INTERVAL_INSTANCE(interval_instance,domain_type,itl_compare) typename interval_instance<domain_type,itl_compare>::type
  85. #endif
  86. //------------------------------------------------------------------------------
  87. #define ICL_ALLOC template<class>class
  88. //------------------------------------------------------------------------------
  89. #define ICL_INTERVAL_DEFAULT boost::icl::interval_type_default
  90. #ifndef BOOST_ICL_USE_COMPARE_STD_GREATER
  91. # define ICL_COMPARE_DEFAULT std::less
  92. #else
  93. # define ICL_COMPARE_DEFAULT std::greater
  94. #endif
  95. //------------------------------------------------------------------------------
  96. #endif // BOOST_ICL_DESIGN_CONFIG_HPP_JOFA_090214