std::expected::emplace(3)
π NAME π
okay bestie, this is std::expected::emplace from the C++ Standard Libary β and the name is literally std::expected::emplace minus std::expected::emplace. iconic repetition, no notes π
β¨
β¨ Synopsis β¨
T is not cv void:
template< class... Args >
constexpr T& emplace( Args&&... args ) noexcept;
- (1) since C++23
template< class U, class... Args >
constexpr T& emplace( std::initializer_list<U> il, Args&&... args ) noexcept;
- (2) since C++23
T is cv void:
constexpr void emplace() noexcept;
- (3) since C++23
Constructs an expected value in-place. After the call, has_value() returns true. π«Ά
- Destroys the contained value, then initializes the expected value contained in
*thisas if by direct-initializing an object of typeTfrom the argumentsstd::forward<Args>(args)....
This overload participates in overload resolution only if std::is_nothrow_constructible_v<T, Args...> is true.
- Destroys the contained value, then initializes the expected value contained in
*thisas if by direct-initializing an object of typeTfrom the argumentsilandstd::forward<Args>(args)....
This overload participates in overload resolution only if std::is_nothrow_constructible_v<T, std::initializer_list<U>&, Args...> is true.
- If
*thiscontains an unexpected value, destroys that value.
π Parameters π
argsβ the arguments to pass to the constructorilβ the initializer list to pass to the constructor
π«Ά Return value π«Ά
- 1,2) A reference to the new contained value.
- 3) (none)
π§ Notes π§
If the construction of T is potentially-throwing, this function is not defined. In this case, it is the responsibility of the user to create a temporary object and move or copy it. π«‘
π Example π
This section is incomplete Reason: no example
π See also π
operator=β assigns contents (public member function)
π Category π
* Todo no example
thatβs the whole page, bestie π source: http://cppreference.com, version/date: 2024.06.10, page: std::expected::emplace(3) π«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms