Home | History | Annotate | Download | only in time.duration.arithmetic
      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 
     10 // <chrono>
     11 
     12 // duration
     13 
     14 // duration operator-() const;
     15 
     16 #include <chrono>
     17 #include <cassert>
     18 
     19 int main()
     20 {
     21     {
     22     const std::chrono::minutes m(3);
     23     std::chrono::minutes m2 = -m;
     24     assert(m2.count() == -m.count());
     25     }
     26 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
     27     {
     28     constexpr std::chrono::minutes m(3);
     29     constexpr std::chrono::minutes m2 = -m;
     30     static_assert(m2.count() == -m.count(), "");
     31     }
     32 #endif
     33 }
     34