xtd 0.2.0
Loading...
Searching...
No Matches
action.cpp

Shows how to use xtd::action alias.

#include <xtd/action>
#include <xtd/console>
#include <algorithm>
using namespace std;
using namespace xtd;
auto main()->int {
auto names = vector {"Bruce", "Alfred", "Tim", "Richard"};
auto print = action<const ustring&> {[](const ustring & value) {
console::write_line(value);
}};
// Display the contents of the list using the print delegate.
for_each(names.begin(), names.end(), print);
// The following demonstrates the lambda of c++ to display the contents of the list to the console.
for_each(names.begin(), names.end(), [](const ustring & value) {
console::write_line(value);
});
}
// This code produces the following output:
//
// Bruce
// Alfred
// Tim
// Richard
// Bruce
// Alfred
// Tim
// Richard
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
delegate< void(arguments_t...)> action
Represents a xtd::delegate that has variable parameters and does not return a value.
Definition action.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10