​
Features
​
-
Single and multicast delegate
-
event, event_args and event_handler are base classes for eventing.
-
action represents a delegate that has variable parameters and does not return a value.
-
func represents a delegate that has variables parameters and returns a value of the type specified by the result_t type.
-
predicate represents a delagate that defines a set of criteria and determines whether the specified object meets those criteria.
-
overload represents class that use to determine one of const and non const overloaded methods.
For more information see:
​
​
Examples
​
The classic first application 'Hello World'.
​
delegates_hello_world.cpp :
​
#include <delegates/delegates>
#include <iostream>
#include <string>
using namespace std;
using namespace delegates;
int main() {
delegate<void(const string& str)> write_line;
write_line += [](const string& str) {
cout << str << endl;
};
write_line += [](auto str) {
cerr << str << endl;
};
write_line("Hello, world!");
}
​
CMakeLists.txt :
​
cmake_minimum_required(VERSION 3.3)
project(delegates_hello_world)
find_package(xtd.tunit REQUIRED)
add_executable(${PROJECT_NAME} delegates_hello_world.cpp)
target_link_libraries(${PROJECT_NAME} tunit)
​
Output
​
Hello, world!
Hello, world!
​
Getting Started
​
-
Installation provides download and install documentation.
-
Examples provides some examples.
​