@@ -49,7 +49,7 @@ bool is_same_type(const T& t, const U& u) {
4949template <typename T, typename U>
5050bool is_same_type () {
5151 bool _same_type = false ;
52- // std::cout << "Overload " << __func__ << std::endl ;
52+ // std::cout << "Overload " << __func__ << "\n" ;
5353 if (typeid (T).hash_code () == typeid (U).hash_code ()) {
5454 _same_type = true ;
5555 }
@@ -67,31 +67,31 @@ int main(void) {
6767 * Returned value can be assigned to an object of std::string.
6868 * operator[] and std::string::at() methods still apply.
6969 */
70- std::cout << " White type: " << typeid (w).name () << std::endl ; // 5White
71- std::cout << " Black type: " << typeid (b).name () << std::endl ; // 5Black
70+ std::cout << " White type: " << typeid (w).name () << " \n " ; // 5White
71+ std::cout << " Black type: " << typeid (b).name () << " \n " ; // 5Black
7272
7373 /* Operation with the returned type. */
7474 const std::string class_name = typeid (w).name ();
75- std::cout << " Class name of object " << std::quoted (" w" ) << " : " << class_name << std::endl
76- << " Length: " << class_name[0 ] << std::endl ; /* class_name.at(0) */
75+ std::cout << " Class name of object " << std::quoted (" w" ) << " : " << class_name << " \n "
76+ << " Length: " << class_name[0 ] << " \n " ; /* class_name.at(0) */
7777
7878 /* Explicitly parse the name of the classes and objects. */
7979 std::cout << std::quoted (" is_same_type<White, Black>(w, b)" ) << " : "
80- << is_same_type<White, Black>(w, b) << std::endl ;
80+ << is_same_type<White, Black>(w, b) << " \n " ;
8181
8282 /* Using decltype() to let the compiler dynamically derive the type. */
8383 std::cout << std::quoted (" is_same_type<decltype(w), decltype(b)>(w, b)" ) << " : "
84- << is_same_type<decltype (w), decltype (b)>(w, b) << std::endl ;
84+ << is_same_type<decltype (w), decltype (b)>(w, b) << " \n " ;
8585
8686 /* With overload function. */
8787 std::cout << std::quoted (" is_same_type<decltype(w), decltype(b)>()" ) << " : "
88- << is_same_type<decltype (w), decltype (b)>() << std::endl ;
88+ << is_same_type<decltype (w), decltype (b)>() << " \n " ;
8989
9090 /* With std::is_same<T, U> from <type_traits>. */
9191 White wht; // create another instance of class White
9292 std::cout << std::quoted (" std::is_same<decltype(w), decltype(wht)>::value" ) << " : "
93- << std::is_same<decltype (w), decltype (wht)>::value << std::endl ;
93+ << std::is_same<decltype (w), decltype (wht)>::value << " \n " ;
9494
9595 system (" pause" );
9696 return 0 ;
97- }
97+ }
0 commit comments