| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // Adaptation to Boost of the libcxx |
| 10 | // Copyright 2010 Vicente J. Botet Escriba |
| 11 | // Distributed under the Boost Software License, Version 1.0. |
| 12 | // See http://www.boost.org/LICENSE_1_0.txt |
| 13 | |
| 14 | #ifndef REP_H |
| 15 | #define REP_H |
| 16 | |
| 17 | #include <boost/config.hpp> |
| 18 | |
| 19 | class Rep |
| 20 | { |
| 21 | public: |
| 22 | int data_; |
| 23 | BOOST_CONSTEXPR Rep() : data_() {} |
| 24 | explicit BOOST_CONSTEXPR Rep(int i) : data_(i) {} |
| 25 | |
| 26 | BOOST_CONSTEXPR bool operator==(int i) const {return data_ == i;} |
| 27 | BOOST_CONSTEXPR bool operator==(const Rep& r) const {return data_ == r.data_;} |
| 28 | |
| 29 | Rep& operator*=(Rep x) {data_ *= x.data_; return *this;} |
| 30 | Rep& operator/=(Rep x) {data_ /= x.data_; return *this;} |
| 31 | }; |
| 32 | |
| 33 | #if 0 |
| 34 | namespace std { |
| 35 | |
| 36 | template <> |
| 37 | struct numeric_limits<Rep> |
| 38 | { |
| 39 | static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () |
| 40 | { |
| 41 | return Rep((std::numeric_limits<int>::max)()); |
| 42 | } |
| 43 | |
| 44 | }; |
| 45 | } // namespace std |
| 46 | |
| 47 | namespace boost { |
| 48 | namespace chrono { |
| 49 | template <> |
| 50 | struct duration_values<Rep> |
| 51 | { |
| 52 | static BOOST_CONSTEXPR Rep zero() {return Rep(0);} |
| 53 | static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () |
| 54 | { |
| 55 | return Rep((std::numeric_limits<int>::max)()); |
| 56 | } |
| 57 | |
| 58 | static BOOST_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION () |
| 59 | { |
| 60 | return Rep(detail::numeric_limits<Rep>::lowest()); |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | } // namespace chrono |
| 65 | } // namespace boost |
| 66 | #endif |
| 67 | #endif // REP_H |
| 68 | |