16namespace sequoia::object
20 requires has_value_type_v<T> || has_element_type_v<T>;
21 typename T::product_type;
23 { a.make(std::declval<typename T::product_type>()) } -> std::same_as<typename T::product_type>;
28 template<
class Product,
class T>
29 inline constexpr bool dependent_value_type_same_as_v{
31 typename Product::value_type;
33 requires std::same_as<T, typename Product::value_type>;
37 template<
class Product,
class T>
38 inline constexpr bool dependent_element_type_same_as_v{
40 typename Product::element_type;
42 requires std::same_as<T, typename Product::element_type>;
47 template<
class Product,
class T>
48 inline constexpr bool product_for_v{
49 (impl::dependent_value_type_same_as_v<Product, T> && initializable_from<Product, T>)
50 || (impl::dependent_element_type_same_as_v<Product, T> && initializable_from<Product, T*>)
53 template<
class Product,
class T>
56 template<std::movable T, makeable_from<T> Product>
59 template<
class... Args>
62 constexpr Product operator()(Args&&... args)
const
64 return Product{std::forward<Args>(args)...};
72 template<std::movable T, makeable_from<T> Product,
class Transformer=direct_forwarder<T, Product>>
76 using product_type = Product;
78 using transfomer_type = Transformer;
80 template<
class... Args>
83 constexpr static product_type make(Args&&... args)
85 return product_type{Transformer{}(std::forward<Args>(args)...)};
89 friend constexpr bool operator==(
const producer&,
const producer&)
noexcept =
default;
Concepts which are sufficiently general to appear in the sequoia namespace.
Creates a product for T.
Definition: Creator.hpp:74
A concept similar to std::constructible_from, but which considers braced-init.
Definition: Concepts.hpp:75
Definition: Creator.hpp:19
Definition: Creator.hpp:54
Definition: Creator.hpp:58