mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-22 12:30:04 +00:00
feat: add basic_value::at(key) and at(idx)
This commit is contained in:
parent
8d1da6e8b5
commit
d73bc6076c
@ -1567,6 +1567,28 @@ class basic_value
|
||||
return std::move(this->table_.value());
|
||||
}
|
||||
|
||||
// accessors =============================================================
|
||||
//
|
||||
// may throw type_error or out_of_range
|
||||
//
|
||||
value_type& at(const key& k)
|
||||
{
|
||||
return this->as_table().at(k);
|
||||
}
|
||||
value_type const& at(const key& k) const
|
||||
{
|
||||
return this->as_table().at(k);
|
||||
}
|
||||
|
||||
value_type& at(const std::size_t idx)
|
||||
{
|
||||
return this->as_array().at(idx);
|
||||
}
|
||||
value_type const& at(const std::size_t idx) const
|
||||
{
|
||||
return this->as_array().at(idx);
|
||||
}
|
||||
|
||||
source_location location() const
|
||||
{
|
||||
return source_location(this->region_info_.get());
|
||||
|
Loading…
Reference in New Issue
Block a user