Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / ACE / tests / Compiler_Features_19_Test.cpp
blob19ba4cddd761560270f46be1be38fec13dfe3e82
1 /**
2 * This program checks if the compiler / platform supports aliased
3 * templates
4 */
6 #include "test_config.h"
8 #include <string>
9 #include <iostream>
10 #include <cstdint>
12 namespace IDL
14 template<typename _CharT, const uint32_t _Bound,
15 typename _Traits = std::char_traits<_CharT>,
16 typename _Alloc = std::allocator<_CharT> >
17 class bounded_basic_string : public std::basic_string<_CharT, _Traits, _Alloc>
19 using _String = std::basic_string<_CharT, _Traits, _Alloc>;
21 public:
22 static const uint32_t bound_ = _Bound;
24 bounded_basic_string() { }
26 bounded_basic_string(const _CharT* __s,
27 const _Alloc& __a = _Alloc ())
28 : _String(__s, __a) { }
30 ~bounded_basic_string() noexcept
33 uint32_t bound () const
35 return _Bound;
40 template <const uint32_t _Bound>
41 using bounded_string = bounded_basic_string<char, _Bound>;
44 int
45 run_main (int, ACE_TCHAR *[])
47 ACE_START_TEST (ACE_TEXT("Compiler_Features_19_Test"));
49 using string100 = IDL::bounded_string<100>;
50 string100 s100("world");
52 ACE_DEBUG ((LM_DEBUG,
53 ACE_TEXT ("String %C bound %d\n"), s100.c_str(), s100.bound ()));
55 ACE_DEBUG ((LM_INFO,
56 ACE_TEXT ("Template alias works.\n")));
58 ACE_END_TEST;
60 return 0;