]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (C) Copyright John Maddock 2012. |
2 | // Use, modification and distribution are subject to the | |
3 | // Boost Software License, Version 1.0. (See accompanying file | |
4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | // See http://www.boost.org/libs/config for most recent version. | |
7 | ||
8 | // MACRO: BOOST_NO_CXX11_THREAD_LOCAL | |
9 | // TITLE: thread_local | |
10 | // DESCRIPTION: The compiler supports the thread_local storage specifier. | |
11 | ||
12 | #include <string> | |
13 | ||
14 | ||
15 | namespace boost_no_cxx11_thread_local{ | |
16 | ||
b32b8144 FG |
17 | template <class T> |
18 | int check_local(int n) | |
19 | { | |
20 | static thread_local T s(n, ' '); | |
21 | static thread_local int size = s.size(); | |
22 | if(size != n) | |
23 | { | |
24 | s = T(n, ' '); | |
92f5a8d4 | 25 | size = n; |
b32b8144 FG |
26 | } |
27 | return size; | |
28 | } | |
29 | ||
7c673cae FG |
30 | int test() |
31 | { | |
b32b8144 | 32 | return check_local<std::string>(5) == 5 ? 0 : 1; |
7c673cae FG |
33 | } |
34 | ||
35 | } | |
36 |