Function basic_any

Summary

#include <src/entt/core/any.hpp>

(1) constexpr basic_any()

(2) template <typename Type, typename... Args>
    explicit basic_any(std::in_place_type_t< Type >, Args &&...args)

(3) template <typename Type, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Type>, basic_any>>>
    basic_any(Type &&value)

(4) basic_any(const basic_any &other)

(5) basic_any(basic_any &&other)

Function overload

Synopsis

#include <src/entt/core/any.hpp>

constexpr basic_any()

Description

Default constructor.

Source

Lines 143-147 in src/entt/core/any.hpp.

constexpr basic_any() ENTT_NOEXCEPT
    : instance{},
      info{&type_id<void>()},
      vtable{},
      mode{policy::owner} {}

Synopsis

#include <src/entt/core/any.hpp>

template <typename Type, typename... Args>
explicit basic_any(std::in_place_type_t< Type >, Args &&...args)

Description

Constructs a wrapper by directly initializing the new object.

Template Parameters

Type - Type of object to use to initialize the wrapper.

Args - Types of arguments to use to construct the new instance.

Parameters

args - Parameters to use to construct the instance.

Source

Lines 155-159 in src/entt/core/any.hpp.

template<typename Type, typename... Args>
explicit basic_any(std::in_place_type_t<Type>, Args &&...args)
    : basic_any{} {
    initialize<Type>(std::forward<Args>(args)...);
}

Synopsis

#include <src/entt/core/any.hpp>

template <typename Type, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Type>, basic_any>>>
basic_any(Type &&value)

Description

Constructs a wrapper from a given value.

Template Parameters

Type - Type of object to use to initialize the wrapper.

Parameters

value - An instance of an object to use to initialize the wrapper.

Source

Lines 166-170 in src/entt/core/any.hpp.

template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Type>, basic_any>>>
basic_any(Type &&value)
    : basic_any{} {
    initialize<std::decay_t<Type>>(std::forward<Type>(value));
}

Synopsis

#include <src/entt/core/any.hpp>

basic_any(const basic_any &other)

Description

Copy constructor.

Parameters

other - The instance to copy from.

Source

Lines 176-181 in src/entt/core/any.hpp.

basic_any(const basic_any &other)
    : basic_any{} {
    if(other.vtable) {
        other.vtable(operation::copy, other, this);
    }
}

Synopsis

#include <src/entt/core/any.hpp>

basic_any(basic_any &&other)

Description

Move constructor.

Parameters

other - The instance to move from.

Source

Lines 187-195 in src/entt/core/any.hpp.

basic_any(basic_any &&other) ENTT_NOEXCEPT
    : instance{},
      info{other.info},
      vtable{other.vtable},
      mode{other.mode} {
    if(other.vtable) {
        other.vtable(operation::move, other, this);
    }
}





Add Discussion

Log in to comment