Struct basic_container

Synopsis

#include <src/entt/meta/container.hpp>

template<typename Container>
struct basic_container

Description

Basic STL-compatible container traits.

Template Parameters

Container - The type of the container.

Methods

beginReturns an iterator to the first element of the given container.
endReturns an iterator past the last element of the given container.
sizeReturns the size of the given container.

Source

Lines 32-67 in src/entt/meta/container.hpp.

template<typename Container>
struct basic_container {
    /*! @brief Iterator type of the container. */
    using iterator = typename Container::iterator;
    /*! @brief Unsigned integer type. */
    using size_type = typename Container::size_type;
    /*! @brief Value type of the container. */
    using value_type = typename Container::value_type;

    /**
     * @brief Returns the size of the given container.
     * @param cont The container for which to return the size.
     * @return The size of the given container.
     */
    [[nodiscard]] static size_type size(const Container &cont) ENTT_NOEXCEPT {
        return cont.size();
    }

    /**
     * @brief Returns an iterator to the first element of the given container.
     * @param cont The container for which to return the iterator.
     * @return An iterator to the first element of the given container.
     */
    [[nodiscard]] static iterator begin(Container &cont) {
        return cont.begin();
    }

    /**
     * @brief Returns an iterator past the last element of the given container.
     * @param cont The container for which to return the iterator.
     * @return An iterator past the last element of the given container.
     */
    [[nodiscard]] static iterator end(Container &cont) {
        return cont.end();
    }
};





Add Discussion

Log in to comment