1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /*
- * Demonstrates the use of std::bind_front from cxxomfort backports.
- * */
- #include <cxxomfort/base.hpp>
- #include <cxxomfort/functional.hpp>
- #include <cxxomfort/tuple.hpp>
- #include <cxxomfort/string.hpp>
- #include <cxxomfort/string_view.hpp>
- #include <iostream>
- #include <iomanip>
- #include <iomanip>
- #include <cxxomfort/library/type_name.hpp>
- #include <cxxomfort/ostream.hpp>
- #if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILERSUPPORT_typeof)
- #else
- #error "This test requires C++>=2011 or at least __typeof__ support."
- #endif
- using cxxomfort::library::type_name;
- struct expr_t {
- double operator() (double A, double B, double C) const {
- using namespace std;
- return A + B - C;
- }
- };
- int main () {
- using namespace std;
- using cxxomfort::cxxostd::bind_front;
- cxxomfort::output_info(stdout);
- cout<< endl;
- CXXO_AUTO(exprem , bind_front( expr_t(), 1.0, 33.0) );
- cout<< type_name< decltype(exprem)>()<< endl;
- for (double z= 20.0; z >= 5.0; z-=0.5) {
- cout<< exprem(z)<< " \t";
- }
- cout<< endl;
- //cout<< cadenita(string_view("Mundo"))<< endl;
- return 0;
- }
|