BVB Source Codes

mars Show version_type.hpp Source code

Return Download mars: download version_type.hpp Source code - Download mars Source code - Type:.hpp
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. //       This code comes from N1953 document by Howard E. Hinnant
  12. //
  13. //////////////////////////////////////////////////////////////////////////////
  14.  
  15.  
  16. #ifndef BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
  17. #define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
  18.  
  19. #ifndef BOOST_CONFIG_HPP
  20. #  include <boost/config.hpp>
  21. #endif
  22.  
  23. #if defined(BOOST_HAS_PRAGMA_ONCE)
  24. #  pragma once
  25. #endif
  26.  
  27. #include <boost/container/detail/config_begin.hpp>
  28. #include <boost/container/detail/workaround.hpp>
  29.  
  30. #include <boost/container/detail/mpl.hpp>
  31. #include <boost/container/detail/type_traits.hpp>
  32.  
  33. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost{
  34. namespace container {
  35. namespace container_detail {
  36.  
  37. template <class T, unsigned V>
  38. struct version_type
  39.     : public container_detail::integral_constant<unsigned, V>
  40. {
  41.     typedef T type;
  42.  
  43.     version_type(const version_type<T, 0>&);
  44. };
  45.  
  46. namespace impl{
  47.  
  48. template <class T,
  49.           bool = container_detail::is_convertible<version_type<T, 0>, typename T::version>::value>
  50. struct extract_version
  51. {
  52.    static const unsigned value = 1;
  53. };
  54.  
  55. template <class T>
  56. struct extract_version<T, true>
  57. {
  58.    static const unsigned value = T::version::value;
  59. };
  60.  
  61. template <class T>
  62. struct has_version
  63. {
  64.    private:
  65.    struct two {char _[2];};
  66.    template <class U> static two test(...);
  67.    template <class U> static char test(const typename U::version*);
  68.    public:
  69.    static const bool value = sizeof(test<T>(0)) == 1;
  70.    void dummy(){}
  71. };
  72.  
  73. template <class T, bool = has_version<T>::value>
  74. struct version
  75. {
  76.    static const unsigned value = 1;
  77. };
  78.  
  79. template <class T>
  80. struct version<T, true>
  81. {
  82.    static const unsigned value = extract_version<T>::value;
  83. };
  84.  
  85. }  //namespace impl
  86.  
  87. template <class T>
  88. struct version
  89.    : public container_detail::integral_constant<unsigned, impl::version<T>::value>
  90. {};
  91.  
  92. template<class T, unsigned N>
  93. struct is_version
  94. {
  95.    static const bool value =
  96.       is_same< typename version<T>::type, integral_constant<unsigned, N> >::value;
  97. };
  98.  
  99. }  //namespace container_detail {
  100.  
  101. typedef container_detail::integral_constant<unsigned, 0> version_0;
  102. typedef container_detail::integral_constant<unsigned, 1> version_1;
  103. typedef container_detail::integral_constant<unsigned, 2> version_2;
  104.  
  105. }  //namespace container {
  106. }  //namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost{
  107.  
  108. #include <boost/container/detail/config_end.hpp>
  109.  
  110. #endif   //#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
  111.  
downloadversion_type.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