1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // template <class Rep1, class Period1, class Rep2, class Period2>
12 // struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>
14 // typedef chrono::duration<typename common_type<Rep1, Rep2>::type, see below }> type;
19 #include <type_traits>
21 #include "test_macros.h"
23 template <class D1
, class D2
, class De
>
27 typedef typename
std::common_type
<D1
, D2
>::type Dc
;
28 static_assert((std::is_same
<Dc
, De
>::value
), "");
33 test
<std::chrono::duration
<int, std::ratio
<1, 100> >,
34 std::chrono::duration
<long, std::ratio
<1, 1000> >,
35 std::chrono::duration
<long, std::ratio
<1, 1000> > >();
36 test
<std::chrono::duration
<long, std::ratio
<1, 100> >,
37 std::chrono::duration
<int, std::ratio
<1, 1000> >,
38 std::chrono::duration
<long, std::ratio
<1, 1000> > >();
39 test
<std::chrono::duration
<char, std::ratio
<1, 30> >,
40 std::chrono::duration
<short, std::ratio
<1, 1000> >,
41 std::chrono::duration
<int, std::ratio
<1, 3000> > >();
42 test
<std::chrono::duration
<double, std::ratio
<21, 1> >,
43 std::chrono::duration
<short, std::ratio
<15, 1> >,
44 std::chrono::duration
<double, std::ratio
<3, 1> > >();