summaryrefslogtreecommitdiffstats
path: root/libcxx/include/chrono
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-03-21 18:38:57 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-03-21 18:38:57 +0000
commit9bd9ed4d230c4e488947921044f96db164143309 (patch)
tree6418068d88ae87ce438a2e183e31fcb748d97dd5 /libcxx/include/chrono
parent0190698dd31c8f1524a5a414075d8b4eff3b1b0e (diff)
downloadbcm5719-llvm-9bd9ed4d230c4e488947921044f96db164143309.tar.gz
bcm5719-llvm-9bd9ed4d230c4e488947921044f96db164143309.zip
Implement P0548: 'common_type and duration' This involves a subtle change in the return type of the unary +/- operators for std::chrono::duration, though I expect that no one will notice.
llvm-svn: 298416
Diffstat (limited to 'libcxx/include/chrono')
-rw-r--r--libcxx/include/chrono12
1 files changed, 6 insertions, 6 deletions
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index 4e82ef2b5f4..657808736d0 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -48,7 +48,7 @@ class duration
static_assert(Period::num > 0, "duration period must be positive");
public:
typedef Rep rep;
- typedef Period period;
+ typedef typename _Period::type period;
constexpr duration() = default;
template <class Rep2>
@@ -75,8 +75,8 @@ public:
// arithmetic
- constexpr duration operator+() const;
- constexpr duration operator-() const;
+ constexpr common_type<duration>::type operator+() const;
+ constexpr common_type<duration>::type operator-() const;
constexpr duration& operator++();
constexpr duration operator++(int);
constexpr duration& operator--();
@@ -523,7 +523,7 @@ class _LIBCPP_TEMPLATE_VIS duration
public:
typedef _Rep rep;
- typedef _Period period;
+ typedef typename _Period::type period;
private:
rep __rep_;
public:
@@ -565,8 +565,8 @@ public:
// arithmetic
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;}
OpenPOWER on IntegriCloud