numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
invocable_as.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
22#include <functional>
23#include <type_traits>
24#include <utility>
25
27
28namespace num_collect {
29inline namespace base {
30namespace concepts {
31
32namespace impl {
33
42template <typename Func, typename Result, typename... Args>
43concept invocable_as_impl = requires(Func&& func, Args&&... args) {
44 {
45 std::invoke(std::forward<Func>(func), std::forward<Args>(args)...)
47};
48
49} // namespace impl
50
58template <typename Func, typename Signature>
59struct is_invocable_as : public std::false_type {};
60
69template <typename Func, typename Result, typename... Args>
70struct is_invocable_as<Func, Result(Args...)> {
71public:
73 static constexpr bool value =
74 impl::invocable_as_impl<Func, Result, Args...>;
75};
76
84template <typename Func, typename Signature>
86
93template <typename Func, typename Signature>
95
96} // namespace concepts
97} // namespace base
98} // namespace num_collect
Concept of functions which are invocable with given argument types and returns objects with given res...
Concept of types implicitly convertible from the given type.
Concept of functions invocable as a function with the given signature.
Definition of implicitly_convertible_to concept.
constexpr bool is_invocable_as_v
Check whether the given function is invocable as a function with the given signature.
Namespace of num_collect source codes.
Check whether the given function is invocable as a function with the given signature.