Function at

Summary

#include <toml/value.hpp>

(1) value_type & at(const key &k)

(2) value_type const  & at(const key &k) const

(3) value_type & at(const std::size_t idx)

(4) value_type const  & at(const std::size_t idx) const

Function overload

Synopsis

#include <toml/value.hpp>

value_type & at(const key &k)

Description

No description yet.

Mentioned in

  • Getting Started / at()

Source

Lines 1533-1545 in toml/value.hpp.

value_type&       at(const key& k)
{
    if(!this->is_table())
    {
        detail::throw_bad_cast<value_t::table>(
            "toml::value::at(key): ", this->type_, *this);
    }
    if(this->as_table(std::nothrow).count(k) == 0)
    {
        detail::throw_key_not_found_error(*this, k);
    }
    return this->as_table(std::nothrow).at(k);
}

Synopsis

#include <toml/value.hpp>

value_type const  & at(const key &k) const

Description

No description yet.

Mentioned in

  • Getting Started / at()

Source

Lines 1546-1558 in toml/value.hpp.

value_type const& at(const key& k) const
{
    if(!this->is_table())
    {
        detail::throw_bad_cast<value_t::table>(
            "toml::value::at(key): ", this->type_, *this);
    }
    if(this->as_table(std::nothrow).count(k) == 0)
    {
        detail::throw_key_not_found_error(*this, k);
    }
    return this->as_table(std::nothrow).at(k);
}

Synopsis

#include <toml/value.hpp>

value_type & at(const std::size_t idx)

Description

No description yet.

Mentioned in

  • Getting Started / at()

Source

Lines 1573-1590 in toml/value.hpp.

value_type&       at(const std::size_t idx)
{
    if(!this->is_array())
    {
        detail::throw_bad_cast<value_t::array>(
            "toml::value::at(idx): ", this->type_, *this);
    }
    if(this->as_array(std::nothrow).size() <= idx)
    {
        throw std::out_of_range(detail::format_underline(
            "toml::value::at(idx): no element corresponding to the index", {
                {this->location(), concat_to_string("the length is ",
                    this->as_array(std::nothrow).size(),
                    ", and the specified index is ", idx)}
            }));
    }
    return this->as_array().at(idx);
}

Synopsis

#include <toml/value.hpp>

value_type const  & at(const std::size_t idx) const

Description

No description yet.

Mentioned in

  • Getting Started / at()

Source

Lines 1591-1608 in toml/value.hpp.

value_type const& at(const std::size_t idx) const
{
    if(!this->is_array())
    {
        detail::throw_bad_cast<value_t::array>(
            "toml::value::at(idx): ", this->type_, *this);
    }
    if(this->as_array(std::nothrow).size() <= idx)
    {
        throw std::out_of_range(detail::format_underline(
            "toml::value::at(idx): no element corresponding to the index", {
                {this->location(), concat_to_string("the length is ",
                    this->as_array(std::nothrow).size(),
                    ", and the specified index is ", idx)}
            }));
    }
    return this->as_array(std::nothrow).at(idx);
}





Add Discussion as Guest

Log in