Simple-Vector v1.3.0
Functional.hpp
Go to the documentation of this file.
1// Copyright Dominic Koepke 2021 - 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// https://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef SIMPLE_VECTOR_FUNCTIONAL_HPP
7#define SIMPLE_VECTOR_FUNCTIONAL_HPP
8
9#pragma once
10
11#include "Concepts.hpp"
12
13#include <concepts>
14#include <functional>
15#include <utility>
16
18{
19 template <class TTargetType, std::copy_constructible TFunc>
21 {
22 template <class... TArgs>
23 constexpr TTargetType operator ()(TArgs&&... args)
24 {
25 return static_cast<TTargetType>(std::invoke(func, std::forward<TArgs>(args)...));
26 }
27
28 TFunc func;
29 };
30}
31
32namespace sl::vec::fn
33{
46 template <class TTargetType, std::copy_constructible TFunc>
47 constexpr auto cast_invoke_result(TFunc func) noexcept
48 {
50 }
51
53}
54
55#endif
constexpr auto cast_invoke_result(TFunc func) noexcept
Factory function creating a wrapper function object, which invokes the provided function object and c...
Definition: Functional.hpp:47
Definition: Functional.hpp:18
Definition: Functional.hpp:33
Definition: Functional.hpp:21
TFunc func
Definition: Functional.hpp:28
constexpr TTargetType operator()(TArgs &&... args)
Definition: Functional.hpp:23