@@ -962,14 +962,48 @@ TOML_NAMESPACE_START
962962
963963 // / \brief Returns a view of the subnode matching a fully-qualified "TOML path".
964964 // /
965- // / \see #toml::at_path(node&, std::string_view)
965+ // / \detail \cpp
966+ // / auto config = toml::parse(R"(
967+ // /
968+ // / [foo]
969+ // / bar = [ 0, 1, 2, [ 3 ], { kek = 4 } ]
970+ // /
971+ // / )"sv);
972+ // /
973+ // / std::cout << config.at_path("foo.bar[2]") << "\n";
974+ // / std::cout << config.at_path("foo.bar[3][0]") << "\n";
975+ // / std::cout << config.at_path("foo.bar[4].kek") << "\n";
976+ // / \ecpp
977+ // /
978+ // / \out
979+ // / 2
980+ // / 3
981+ // / 4
982+ // / \eout
983+ // /
984+ // /
985+ // / \note Keys in paths are interpreted literally, so whitespace (or lack thereof) matters:
986+ // / \cpp
987+ // / config.at_path( "foo.bar") // same as node_view{ config }["foo"]["bar"]
988+ // / config.at_path( "foo. bar") // same as node_view{ config }["foo"][" bar"]
989+ // / config.at_path( "foo..bar") // same as node_view{ config }["foo"][""]["bar"]
990+ // / config.at_path( ".foo.bar") // same as node_view{ config }[""]["foo"]["bar"]
991+ // / \ecpp
992+ // / <br>
993+ // / Additionally, TOML allows '.' (period) characters to appear in keys if they are quoted strings.
994+ // / This function makes no allowance for this, instead treating all period characters as sub-table delimiters.
995+ // / If you have periods in your table keys, first consider:
996+ // / 1. Not doing that
997+ // / 2. Using node_view::operator[] instead.
998+ // /
999+ // / \param path The "TOML path" to traverse.
9661000 TOML_NODISCARD
9671001 TOML_API
9681002 node_view<node> at_path (std::string_view path) noexcept ;
9691003
9701004 // / \brief Returns a const view of the subnode matching a fully-qualified "TOML path".
9711005 // /
972- // / \see #toml:: at_path(node&, std::string_view)
1006+ // / \see #at_path(std::string_view)
9731007 TOML_NODISCARD
9741008 TOML_API
9751009 node_view<const node> at_path (std::string_view path) const noexcept ;
@@ -980,7 +1014,7 @@ TOML_NAMESPACE_START
9801014 // /
9811015 // / \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled.
9821016 // /
983- // / \see #toml:: at_path(node&, std::string_view)
1017+ // / \see #at_path(std::string_view)
9841018 TOML_NODISCARD
9851019 TOML_API
9861020 node_view<node> at_path (std::wstring_view path);
@@ -989,7 +1023,7 @@ TOML_NAMESPACE_START
9891023 // /
9901024 // / \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled.
9911025 // /
992- // / \see #toml:: at_path(node&, std::string_view)
1026+ // / \see #at_path(std::string_view)
9931027 TOML_NODISCARD
9941028 TOML_API
9951029 node_view<const node> at_path (std::wstring_view path) const ;
0 commit comments