Skip to content

Instantly share code, notes, and snippets.

@Bloofer
Created February 27, 2019 06:27
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 Bloofer/96fd93cd93fed751021d3ba5517c4414 to your computer and use it in GitHub Desktop.
Save Bloofer/96fd93cd93fed751021d3ba5517c4414 to your computer and use it in GitHub Desktop.
constexpr example
constexpr double power( double x, unsigned int y )
{
return y == 1 ? x : x * power( x, y - 1 ) ;
}
int main()
{
// 정수 식
constexpr double a = power( 2, 32 ) ;
// 정수 식이 아니다
double x = 2 ; unsigned int y = 32 ;
double b = power( x, y ) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment