-
-
Notifications
You must be signed in to change notification settings - Fork 231
/
Copy pathcheck_cxx11.cpp
49 lines (44 loc) · 1.19 KB
/
check_cxx11.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Copyright 2020-2023 Rene Rivera
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE.txt or
* https://www.bfgroup.xyz/b2/LICENSE.txt)
*/
/*
This program is a compile test for support of C++11. If it compiles
successfully some key parts of C++11 the B2 engine requires are
available. This is used by the build script to guess and check the
compiler to build the engine with.
*/
// Some headers we test...
#include <memory>
#include <mutex>
#include <thread>
// Some basic constexpr support?
template <int C>
struct X
{
static constexpr int c = C;
};
int main()
{
#ifndef _WIN32
// Check for basic thread calls.
// [2020-08-19] Mingw-w64 with win32 threading model (as opposed to posix
// threading model) does not really have std::thread etc. Please see
// comments in sysinfo.cpp.
{
auto _ = std::thread::hardware_concurrency();
}
{
std::mutex m;
std::lock_guard<std::mutex> l(m);
std::thread t([]() {});
t.join();
}
#endif
// [2021-08-07] We check the following C++11 features: brace initialization,
// unique_ptr. Plus the author's ability to memorize some digits.
{
const std::unique_ptr<float> pf { new float { 3.14159f } };
}
}