14 template<
typename OutputVector,
typename InputVector,
typename Converter>
15 auto transform(
const InputVector &input, Converter convert)
18 if constexpr (std::ranges::sized_range<InputVector>) {
19 output.reserve(input.size());
21 for (
const auto &value : input) {
22 output.push_back(std::invoke(convert, value));
27 template<
typename Vec,
typename T>
28 auto contains(
const Vec &vec,
const T &value)
30 return std::find(std::begin(vec), std::end(vec), value) != std::end(vec);
33 template<
typename T,
typename Function>
34 auto map(Function mapValue, std::optional<T> &&optValue) -> std::optional<std::invoke_result_t<Function, T &&>>
37 return mapValue(std::move(*optValue));
42 template<
typename To,
typename From>
43 auto into(std::optional<From> &&value) -> std::optional<To>
53 #endif // ALGORITHMS_H Definition: Algorithms.h:12