mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 17:58:09 +08:00
doc: add reference about try_at
This commit is contained in:
@@ -583,6 +583,27 @@ value_type const& at(const key_type& key) const;
|
||||
|
||||
-----
|
||||
|
||||
### `try_at(key)`
|
||||
|
||||
```cpp
|
||||
result<std::reference_wrapper<value_type>, error_info> try_at(const key_type& key) noexcept;
|
||||
result<std::reference_wrapper<const value_type>, error_info> try_at(const key_type& key) const noexcept;
|
||||
```
|
||||
|
||||
#### 戻り値
|
||||
|
||||
今の`value`を`table`にキャストしたあと、`key`によって指定される要素を返します。
|
||||
|
||||
成功した場合、その要素への参照を持つ`reference_wrapper`を返します。
|
||||
|
||||
失敗した場合、 `type_error` または `out_of_range` に対応する `error_info` を返します。
|
||||
|
||||
#### 例外
|
||||
|
||||
投げません。
|
||||
|
||||
-----
|
||||
|
||||
#### `operator[](key)`
|
||||
|
||||
```cpp
|
||||
@@ -652,6 +673,27 @@ value_type const& at(const std::size_t idx) const;
|
||||
|
||||
-----
|
||||
|
||||
### `try_at(idx)`
|
||||
|
||||
```cpp
|
||||
result<std::reference_wrapper<value_type>, error_info> try_at(const std::size_t idx) noexcept;
|
||||
result<std::reference_wrapper<const value_type>, error_info> try_at(const std::size_t idx) const noexcept;
|
||||
```
|
||||
|
||||
#### 戻り値
|
||||
|
||||
今の`value`を`array`にキャストしたあと、`idx`によって指定される要素を返します。
|
||||
|
||||
成功した場合、その要素への参照を持つ`reference_wrapper`を返します。
|
||||
|
||||
失敗した場合、 `type_error` または `out_of_range` に対応する `error_info` を返します。
|
||||
|
||||
#### 例外
|
||||
|
||||
投げません。
|
||||
|
||||
-----
|
||||
|
||||
### `operator[](idx)`
|
||||
|
||||
```cpp
|
||||
|
Reference in New Issue
Block a user