Blame view

3rdparty/boost_1_81_0/libs/chrono/test/rep.h 1.67 KB
e6ccf0ce   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
56
57
58
59
60
61
62
63
64
65
66
67
  //===----------------------------------------------------------------------===//
  //
  //                     The LLVM Compiler Infrastructure
  //
  // This file is dual licensed under the MIT and the University of Illinois Open
  // Source Licenses. See LICENSE.TXT for details.
  //
  //===----------------------------------------------------------------------===//
  //  Adaptation to Boost of the libcxx
  //  Copyright 2010 Vicente J. Botet Escriba
  //  Distributed under the Boost Software License, Version 1.0.
  //  See http://www.boost.org/LICENSE_1_0.txt
  
  #ifndef REP_H
  #define REP_H
  
  #include <boost/config.hpp>
  
  class Rep
  {
  public:
      int data_;
      BOOST_CONSTEXPR Rep() : data_() {}
      explicit BOOST_CONSTEXPR Rep(int i) : data_(i) {}
  
      BOOST_CONSTEXPR bool operator==(int i) const {return data_ == i;}
      BOOST_CONSTEXPR bool operator==(const Rep& r) const {return data_ == r.data_;}
  
      Rep& operator*=(Rep x) {data_ *= x.data_; return *this;}
      Rep& operator/=(Rep x) {data_ /= x.data_; return *this;}
  };
  
  #if 0
  namespace std {
  
    template <>
    struct numeric_limits<Rep>
    {
      static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
      {
        return Rep((std::numeric_limits<int>::max)());
      }
  
    };
  }  // namespace std
  
  namespace boost {
  namespace chrono {
  template <>
  struct duration_values<Rep>
  {
    static BOOST_CONSTEXPR Rep zero() {return Rep(0);}
    static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
    {
      return Rep((std::numeric_limits<int>::max)());
    }
  
    static BOOST_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()
    {
      return Rep(detail::numeric_limits<Rep>::lowest());
    }
  };
  
  }  // namespace chrono
  }  // namespace boost
  #endif
  #endif  // REP_H