BVB Source Codes

mars Show minimum_category.hpp Source code

Return Download mars: download minimum_category.hpp Source code - Download mars Source code - Type:.hpp
  1. // Copyright David Abrahams 2003. Use, modification and distribution is
  2. // subject to the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_
  5. # define BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_
  6.  
  7. # include <boost/static_assert.hpp>
  8. # include <boost/type_traits/is_convertible.hpp>
  9. # include <boost/type_traits/is_same.hpp>
  10.  
  11. # include <boost/mpl/placeholders.hpp>
  12. # include <boost/mpl/aux_/lambda_support.hpp>
  13.  
  14. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost {
  15. namespace iterators {
  16. namespace detail {
  17.  
  18. template <bool GreaterEqual, bool LessEqual>
  19. struct minimum_category_impl;
  20.  
  21. template <class T1, class T2>
  22. struct error_not_related_by_convertibility;
  23.  
  24. template <>
  25. struct minimum_category_impl<true,false>
  26. {
  27.     template <class T1, class T2> struct apply
  28.     {
  29.         typedef T2 type;
  30.     };
  31. };
  32.  
  33. template <>
  34. struct minimum_category_impl<false,true>
  35. {
  36.     template <class T1, class T2> struct apply
  37.     {
  38.         typedef T1 type;
  39.     };
  40. };
  41.  
  42. template <>
  43. struct minimum_category_impl<true,true>
  44. {
  45.     template <class T1, class T2> struct apply
  46.     {
  47.         BOOST_STATIC_ASSERT((is_same<T1,T2>::value));
  48.         typedef T1 type;
  49.     };
  50. };
  51.  
  52. template <>
  53. struct minimum_category_impl<false,false>
  54. {
  55.     template <class T1, class T2> struct apply
  56.       : error_not_related_by_convertibility<T1,T2>
  57.     {
  58.     };
  59. };
  60.  
  61. } // namespace detail
  62.  
  63. //
  64. // Returns the minimum category type or fails to compile
  65. // if T1 and T2 are unrelated.
  66. //
  67. template <class T1 = mpl::_1, class T2 = mpl::_2>
  68. struct minimum_category
  69. {
  70.     typedef mars_boost::iterators::detail::minimum_category_impl<
  71.         ::mars_boost::is_convertible<T1,T2>::value
  72.       , ::mars_boost::is_convertible<T2,T1>::value
  73.     > outer;
  74.  
  75.     typedef typename outer::template apply<T1,T2> inner;
  76.     typedef typename inner::type type;
  77.  
  78.     BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2))
  79. };
  80.  
  81. template <>
  82. struct minimum_category<mpl::_1,mpl::_2>
  83. {
  84.     template <class T1, class T2>
  85.     struct apply : minimum_category<T1,T2>
  86.     {};
  87.  
  88.     BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2))
  89. };
  90.  
  91. } // namespace iterators
  92.  
  93. } // namespace mars_boost
  94.  
  95. #endif // BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_
  96.  
downloadminimum_category.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top