Doxygen changes
[ACE_TAO.git] / ACE / tests / Compiler_Features_19_Test.cpp
blob99e17b84fabd660de4e050546f148aed92d5f9d7
1 /**
2 * This program checks if the compiler / platform supports aliased
3 * templates
4 */
6 #include "test_config.h"
8 #if defined (ACE_HAS_CPP11)
10 #include <string>
11 #include <iostream>
12 #include <cstdint>
14 namespace IDL
16 template<typename _CharT, const uint32_t _Bound,
17 typename _Traits = std::char_traits<_CharT>,
18 typename _Alloc = std::allocator<_CharT> >
19 class bounded_basic_string : public std::basic_string<_CharT, _Traits, _Alloc>
21 typedef std::basic_string<_CharT, _Traits, _Alloc> _String;
23 public:
24 static const uint32_t bound_ = _Bound;
26 bounded_basic_string() { }
28 bounded_basic_string(const _CharT* __s,
29 const _Alloc& __a = _Alloc ())
30 : _String(__s, __a) { }
32 ~bounded_basic_string() noexcept
35 uint32_t bound () const
37 return _Bound;
42 template <const uint32_t _Bound>
43 using bounded_string = bounded_basic_string<char, _Bound>;
46 int
47 run_main (int, ACE_TCHAR *[])
49 ACE_START_TEST (ACE_TEXT("Compiler_Features_19_Test"));
51 typedef IDL::bounded_string<100> string100;
52 string100 s100("world");
54 ACE_DEBUG ((LM_DEBUG,
55 ACE_TEXT ("String %C bound %d\n"), s100.c_str(), s100.bound ()));
57 ACE_DEBUG ((LM_INFO,
58 ACE_TEXT ("Template alias works.\n")));
60 ACE_END_TEST;
62 return 0;
65 #else
66 int
67 run_main (int, ACE_TCHAR *[])
69 ACE_START_TEST (ACE_TEXT("Compiler_Features_19_Test"));
71 ACE_DEBUG ((LM_INFO,
72 ACE_TEXT ("No C++11 support enabled\n")));
74 ACE_END_TEST;
75 return 0;
78 #endif