std::inplace_vector<T,N>::unchecked_push_back

Appends the given element value to the end of the container.

# Declarations

constexpr reference unchecked_push_back( const T& value );

(since C++26)

constexpr reference unchecked_push_back( T&& value );

(since C++26)

# Parameters

# Return value

back(), i.e. a reference to the inserted element.

# Notes

This section is incompleteReason: Explain the purpose of this API.

# Example

#include <cassert>
#include <inplace_vector>
#include <string>
 
int main()
{
    std::inplace_vector<std::string, 2> fauna;
    std::string dog{"dog"};
 
    auto& r1 = fauna.unchecked_push_back("cat"); // overload (1)
    assert(r1 == "cat" and fauna.size() == 1);
    auto& r2 = fauna.unchecked_push_back(std::move(dog)); // overload (2)
    assert(r2 == "dog" and fauna.size() == 2);
    assert(fauna[0] == "cat" and fauna[1] == "dog");
    // fauna.unchecked_push_back("bug"); // undefined behavior: there is no space
}

# See also