mirror of
https://github.com/boostorg/yap.git
synced 2026-01-29 08:02:23 +00:00
23 lines
446 B
C++
23 lines
446 B
C++
//[ calc2b
|
|
#include <boost/yap/expression.hpp>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
int main ()
|
|
{
|
|
using namespace boost::yap::literals;
|
|
|
|
// Displays "5"
|
|
std::cout << make_expression_function(1_p + 2.0)(3.0) << std::endl;
|
|
|
|
// Displays "6"
|
|
std::cout << make_expression_function(1_p * 2_p)(3.0, 2.0) << std::endl;
|
|
|
|
// Displays "0.5"
|
|
std::cout << make_expression_function((1_p - 2_p) / 2_p)(3.0, 2.0) << std::endl;
|
|
|
|
return 0;
|
|
}
|
|
//]
|