Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
bind function
//Title of this code //g++ 4.9.1 #include <iostream> #include <boost/function.hpp> #include <boost/bind.hpp> typedef boost::function<bool()> Pred; class Orch{ public: Orch(Pred iPred) { _pred = iPred; } void execute() { if(_pred()) { std::cout << "pred is true" << std::endl; } else { std::cout << "pred is false" << std::endl; } } private: Pred _pred; }; bool myPred(){ return false; } bool myPred2(){ return true; } int main() { Orch aOrch(boost::bind(myPred) && boost::bind(myPred2)); aOrch.execute(); std::cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
Dejalo a la Suerte
cache_node.cc
ClassQuiz2
ONP is working!
Handling new types without using RTTI
ADVENTURE CODE CSCI40
Substring search
CPP - Arrays - Ex.1
Sample Code from Scott Meyer's Blog
max_recursion