value_ref::value_ref

Constructors.

Synopsis

value_ref(
    value_ref const&); (1)

value_ref(
    value_ref&&); (2)

value_ref(
    string_view s) noexcept; (3)

template<
    class T>
value_ref(
    T const& t) noexcept; (4)

template<
    class T>
value_ref(
    T&& t) noexcept; (5)

value_ref(
    bool b) noexcept; (6)

value_ref(
    signed char t) noexcept; (7)

value_ref(
    short t) noexcept; (8)

value_ref(
    int t) noexcept; (9)

value_ref(
    long t) noexcept; (10)

value_ref(
    long long t) noexcept; (11)

value_ref(
    unsigned char t) noexcept; (12)

value_ref(
    unsigned short t) noexcept; (13)

value_ref(
    unsigned int t) noexcept; (14)

value_ref(
    unsigned long t) noexcept; (15)

value_ref(
    unsigned long long t) noexcept; (16)

value_ref(
    float t) noexcept; (17)

value_ref(
    double t) noexcept; (18)

value_ref(
    std::nullptr_t) noexcept; (19)

value_ref(
    std::initializer_list< value_ref > init) noexcept; (20)

Description

  • (1) copy constructor.

  • (2) move constructor.

  • (3) the constructed value stores a reference to t's character array.

  • (4) the constructed value stores a const reference to t.

  • (5) the constructed value stores an rvalue reference to t.

  • (6) the constructed value stores a copy of b.

  • (7)(18) the constructed value stores a copy of t.

  • (19) the constrcuted value stores nullptr.

  • (20) the constrcuted value stores a copy of init.

In addition the constructed object stores a pointer to a function that captures the type information necessary to construct a value from the stored data.

The overloads that accept references do not take ownership of referenced objects. The caller is responsible for making sure those objects do not go out of scope before the value_ref object is used. It is advised you only use value_ref (or any type that contains a value_ref subobject) as function parameters or take special care to not invoke undefeined behavior.

Complexity

  • (1)(19) constant.

  • (20) linear in init.size().

Exception Safety

No-throw guarantee.