Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::concepts::Mappable Concept Referenceexport

A type that supports monadic map operations. More...

#include <core.h>

Concept definition

template<typename T>
concept kcenon::common::concepts::Mappable = requires(const T t) {
{ t.map(std::declval<std::function<int(typename T::value_type)>>()) };
}
A type that supports monadic map operations.
Definition core.h:99

Detailed Description

A type that supports monadic map operations.

Types satisfying this concept can transform their contained value using a function, propagating errors automatically.

Example usage:

template<Mappable M>
auto transform(const M& container) {
return container.map([](auto& val) { return val * 2; });
}

Definition at line 99 of file core.h.