//********************************************************
// The following code example is taken from the book
//  C++23 - The Complete Guide
//  by Nicolai M. Josuttis (www.josuttis.com)
//  https://www.cppstd23.com
//
// The code is licensed under a
//  Creative Commons Attribution 4.0 International License
//  https://creativecommons.org/licenses/by/4.0/
//********************************************************


#include <iostream>

constexpr int foo()
{
  if consteval {
    return 42;  // compile-time behavior
  }
  else {
    return 72;  // runtime behavior
  }
}

int main()
{
  int x = foo();            // runtime context
  constexpr int c = foo();  // compile-time context

  std::cout << "x: " << x << '\n';
  std::cout << "c: " << c << '\n';
}

