From 58e6f660f3ff0abc77eb879814188809e9bf1995 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 27 Aug 2014 18:47:05 +0200 Subject: Chrono: add implicit conversion operator from std::chrono::duration --- src/Chrono.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Chrono.hxx b/src/Chrono.hxx index e9edb8b09..4c9fafe58 100644 --- a/src/Chrono.hxx +++ b/src/Chrono.hxx @@ -37,6 +37,14 @@ public: template explicit constexpr SongTime(T t):Base(t) {} + /** + * This constructor allows implicit conversion from the base + * class to this class. It is necessary because all of + * std::chrono::duration's operators return another + * std::chrono::duration and not an instance of this class. + */ + constexpr SongTime(Base b):Base(b) {} + static constexpr SongTime FromS(unsigned s) { return SongTime(rep(s) * 1000); } -- cgit v1.2.3