60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
/*
|
|
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;
|
|
}}
|
|
|