std::default_initializable
From cppreference.com
 
 
 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Concepts library 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
default_initializable
(C++20)
  (C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
 Exposition-only concepts
 (C++20)
Defined in header 
 
 
<concepts> 
 template< class T >
 
 (since C++20) 
concept default_initializable = std::constructible_from <T> && requires { T{}; } && 
The default_initializable concept checks whether variables of type T can be 
- value-initialized (i.e., whether T() is well-formed);
- direct-list-initialized from an empty initializer list (i.e., whether T{} is well-formed); and
- default-initialized (i.e., whether T t; is well-formed).
Access checking is performed as if in a context unrelated to T. Only the validity of the immediate context of the variable initialization is considered.
[edit] Possible implementation
template<class T> concept default_initializable = std::constructible_from <T> && requires { T{}; ::new T; };
[edit] References
- C++23 standard (ISO/IEC 14882:2024):
-  18.4.12 Concept default_initializable[concept.default.init]
 
-  18.4.12 Concept 
- C++20 standard (ISO/IEC 14882:2020):
-  18.4.12 Concept default_initializable[concept.default.init]
 
-  18.4.12 Concept 
[edit] See also
(C++20)
(concept) [edit]