old_mile.cpp and adl.cpp
This commit is contained in:
59
cpp/adl.cpp
Normal file
59
cpp/adl.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
VIM: let b:cf5build="clang -std=c++20 -O2 -pthread -lstdc++ -I. {SRC} -o {OUT}"
|
||||
VIM: let b:cf5run="{OUT}"
|
||||
VIM-: let b:cppflags=g:Iboost.g:Itbb
|
||||
VIM-: let b:ldflags=g:Lboost.g:Ltbb
|
||||
VIM-: let b:ldlibpath=g:Bboost.g:Btbb
|
||||
*/
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <chrono>
|
||||
|
||||
namespace ttt {
|
||||
struct s {
|
||||
};
|
||||
void print( const s& t ){
|
||||
std::cout << "ttt::print" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
namespace C
|
||||
{
|
||||
template <typename T>
|
||||
void print( T t ){
|
||||
std::cout << "C::print" << std::endl;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void call_print( const T& t ){
|
||||
print( t );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main ( void )
|
||||
{try{
|
||||
auto begin = std::chrono::high_resolution_clock::now();
|
||||
|
||||
|
||||
//......
|
||||
C::call_print(ttt::s{});
|
||||
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::duration<double> seconds = end - begin;
|
||||
std::cout << "Time: " << seconds.count() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
catch ( const std::exception& e )
|
||||
{
|
||||
std::cerr << std::endl
|
||||
<< "std::exception(\"" << e.what() << "\")." << std::endl;
|
||||
return 2;
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
std::cerr << std::endl
|
||||
<< "unknown exception." << std::endl;
|
||||
return 1;
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user