-
Notifications
You must be signed in to change notification settings - Fork 1
/
complex_sample.hpp
36 lines (29 loc) · 1.3 KB
/
complex_sample.hpp
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
#if defined(COMPILER_DIAGNOSTICS)
#include "compiler_diagnostics.hpp"
#endif
#if defined(BOOST_SUPPORT)
#include <boost/type_index.hpp>
#endif
#include <vector>
#include <iostream>
template<typename T>
void f(const T& param) {
#if defined(COMPILER_DIAGNOSTICS)
TD<decltype(param)> t;
#endif
std::cout << "-- reports by std:" << std::endl;
std::cout << "typeid(T).name(): " << typeid(T).name() << std::endl;
std::cout << "typeid(decltype(param)).name(): " << typeid(decltype(param)).name() << std::endl;
std::cout << "std::is_const<T>(): " << std::is_const<T>()
<< ", std::is_reference<T>(): " << std::is_reference<T>() << std::endl;
std::cout << "std::is_const<decltype(param)>(): " << std::is_const<decltype(param)>()
<< ", std::is_reference<decltype(param)>(): " << std::is_reference<decltype(param)>() << std::endl;
std::cout << std::endl;
#if defined(BOOST_SUPPORT)
std::cout << "-- reports by boost::type_index:" << std::endl;
std::cout << "boost::typeindex::type_id_with_cvr<T>().pretty_name(): "
<< boost::typeindex::type_id_with_cvr<T>().pretty_name() << std::endl;
std::cout << "boost::typeindex::type_id_with_cvr<decltype(param)>().pretty_name(): "
<< boost::typeindex::type_id_with_cvr<decltype(param)>().pretty_name() << std::endl;
#endif
}