Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/concepts/constructible from"

From cppreference.com
< cpp‎ | concepts
m (fmt)
m (+mark)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
{{cpp/title|constructible_from}}
+
{{cpp/title|constructible_from {{mark since c++20}}}}
 
{{cpp/concepts/navbar}}
 
{{cpp/concepts/navbar}}
 
{{ddcl|header=concepts|since=c++20|1=
 
{{ddcl|header=concepts|since=c++20|1=
Line 8: Line 8:
  
 
The {{tt|constructible_from}} concept specifies that a variable of type {{tt|T}} can be initialized with the given set of argument types {{tt|Args...}}.
 
The {{tt|constructible_from}} concept specifies that a variable of type {{tt|T}} can be initialized with the given set of argument types {{tt|Args...}}.
 +
 +
===References===
 +
{{ref std c++23}}
 +
{{ref std|section=18.4.11|title=Concept {{tt|constructible_from}}|id=concept.constructible}}
 +
{{ref std end}}
 +
{{ref std c++20}}
 +
{{ref std|section=18.4.11|title=Concept {{tt|constructible_from}}|id=concept.constructible}}
 +
{{ref std end}}
  
 
===See also===
 
===See also===

Latest revision as of 09:46, 7 September 2024

Defined in header <concepts>
template< class T, class... Args >

concept constructible_from =

    std::destructible<T> && std::is_constructible_v<T, Args...>;
(since C++20)

The constructible_from concept specifies that a variable of type T can be initialized with the given set of argument types Args....

[edit] References

  • C++23 standard (ISO/IEC 14882:2024):
  • 18.4.11 Concept constructible_from [concept.constructible]
  • C++20 standard (ISO/IEC 14882:2020):
  • 18.4.11 Concept constructible_from [concept.constructible]

[edit] See also

checks if a type has a constructor for specific arguments
(class template) [edit]