Blame view

3rdparty/boost_1_81_0/boost/hof/detail/and.hpp 1.33 KB
63e88f80   Hu Chunming   提交三方库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  /*=============================================================================
      Copyright (c) 2015 Paul Fultz II
      and.h
      Distributed under the Boost Software License, Version 1.0. (See accompanying
      file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  ==============================================================================*/
  
  #ifndef BOOST_HOF_GUARD_AND_H
  #define BOOST_HOF_GUARD_AND_H
  
  #include <type_traits>
  #include <boost/hof/detail/using.hpp>
  #include <boost/hof/detail/intrinsics.hpp>
  
  namespace boost { namespace hof { namespace detail {
  
  constexpr bool and_c()
  {
      return true;
  }
  
  template<class... Ts>
  constexpr bool and_c(bool b, Ts... bs)
  {
      return b && and_c(bs...);
  }
  
  #ifdef _MSC_VER
  
  template<class... Ts>
  struct and_;
  
  template<class T, class... Ts>
  struct and_<T, Ts...>
  : std::integral_constant<bool, (T::value && and_<Ts...>::value)>
  {};
  
  template<>
  struct and_<>
  : std::true_type
  {};
  
  #define BOOST_HOF_AND_UNPACK(Bs) (boost::hof::detail::and_c(Bs...))
  #else
  template<bool...> struct bool_seq {};
  template<class... Ts>
  BOOST_HOF_USING(and_, std::is_same<bool_seq<Ts::value...>, bool_seq<(Ts::value, true)...>>);
  
  #define BOOST_HOF_AND_UNPACK(Bs) BOOST_HOF_IS_BASE_OF(boost::hof::detail::bool_seq<Bs...>, boost::hof::detail::bool_seq<(Bs || true)...>)
  
  #endif
  
  }}} // namespace boost::hof
  
  #endif