halcheck 1.0
Loading...
Searching...
No Matches
constructor.hpp
1#ifndef HALCHECK_LIB_FUNCTIONAL_CONSTRUCTOR_HPP
2#define HALCHECK_LIB_FUNCTIONAL_CONSTRUCTOR_HPP
3
4// IWYU pragma: private, include <halcheck/lib/functional.hpp>
5
6#include <halcheck/lib/type_traits.hpp>
7
8namespace halcheck { namespace lib {
9
15template<typename T>
24 template<typename... Args, HALCHECK_REQUIRE(std::is_constructible<T, Args...>())>
25 T operator()(Args... args) {
26 return T(std::forward<Args>(args)...);
27 }
28};
29
30}} // namespace halcheck::lib
31
32#endif
T forward(T... args)
#define HALCHECK_REQUIRE(...)
Expands to a template argument that is only valid if the given argument evaluates to true.
Definition type_traits.hpp:24
T operator()(Args... args)
Invokes a constructor of T.
Definition constructor.hpp:25
A function object that calls the constructor of a given type.
Definition constructor.hpp:16