Skip to content

Instantly share code, notes, and snippets.

@minamiyama1994
Created May 7, 2014 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minamiyama1994/f052a7a970a89011031f to your computer and use it in GitHub Desktop.
Save minamiyama1994/f052a7a970a89011031f to your computer and use it in GitHub Desktop.
C++でコンパイル時eval(誇張あり) ref: http://qiita.com/minamiyama1994/items/60213c62a54998bb431e
#include<typeinfo>
#include"CTE/CTE.hpp"
auto main ( ) -> int
{
auto eval1 = CTE_EVAL ( "1+20*10/(5+5)" ) ;
auto eval2 = CTE_EVAL ( "1+20*10/(5+5)+.5" ) ;
auto eval3 = CTE_EVAL ( u8R"*****("Hello"+" "+"World")*****" ) ;
std::cout << eval1 << std::endl ;
std::cout << typeid ( eval1 ).name ( ) << std::endl ;
std::cout << eval2 << std::endl ;
std::cout << typeid ( eval2 ).name ( ) << std::endl ;
std::cout << eval3 << std::endl ;
std::cout << typeid ( eval3 ).name ( ) << std::endl ;
}
$ ./prog
21
i
21.5
d
Hello World
Ss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment