MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / emplace

Function emplace

crates/cpp/test_headers/expected.hpp:1762–1770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1760 template <class... Args, detail::enable_if_t<std::is_nothrow_constructible<
1761 T, Args &&...>::value> * = nullptr>
1762 void emplace(Args &&...args) {
1763 if (has_value()) {
1764 val().~T();
1765 } else {
1766 err().~unexpected<E>();
1767 this->m_has_val = true;
1768 }
1769 ::new (valptr()) T(std::forward<Args>(args)...);
1770 }
1771
1772 template <class... Args, detail::enable_if_t<!std::is_nothrow_constructible<
1773 T, Args &&...>::value> * = nullptr>

Callers

nothing calls this directly

Calls 1

has_valueFunction · 0.85

Tested by

no test coverage detected