[libcxx] Add <experimental/chrono>
Summary: This patch adds <experimental/chrono> which only contains a single variable template. See: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#time Reviewers: jroelofs, danalbert, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7352 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227860 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <experimental/chrono>
|
||||
|
||||
#include <experimental/chrono>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
# ifndef _LIBCPP_CHRONO
|
||||
# error "<experimental/chrono> must include <chrono>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
20
test/libcxx/experimental/utilities/time/version.pass.cpp
Normal file
20
test/libcxx/experimental/utilities/time/version.pass.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <experimental/chrono>
|
||||
|
||||
#include <experimental/chrono>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <experimental/chrono>
|
||||
|
||||
#include <experimental/chrono>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Check that <chrono> has been included.
|
||||
std::chrono::seconds s;
|
||||
((void)s);
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
|
||||
// <experimental/chrono>
|
||||
|
||||
// template <class Rep> constexpr bool treat_as_floating_point_v;
|
||||
|
||||
#include <experimental/chrono>
|
||||
#include <type_traits>
|
||||
|
||||
namespace ex = std::chrono::experimental;
|
||||
namespace cr = std::chrono;
|
||||
|
||||
template <class T, bool Expect>
|
||||
void test()
|
||||
{
|
||||
static_assert(
|
||||
ex::treat_as_floating_point_v<T> == Expect, ""
|
||||
);
|
||||
static_assert(
|
||||
ex::treat_as_floating_point_v<T> == cr::treat_as_floating_point<T>::value, ""
|
||||
);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<
|
||||
decltype(ex::treat_as_floating_point_v<float>), const bool
|
||||
>::value, ""
|
||||
);
|
||||
}
|
||||
test<int, false>();
|
||||
test<unsigned, false>();
|
||||
test<char, false>();
|
||||
test<bool, false>();
|
||||
test<float, true>();
|
||||
test<double, true>();
|
||||
test<long double, true>();
|
||||
}
|
Reference in New Issue
Block a user