Merge pull request #295 from franzpoeschel/undef-source-location

Add a way to optionally suppress usage of std::source_location b96acf96ba
This commit is contained in:
ToruNiina
2025-12-03 15:01:09 +00:00
commit 360850a8c8
193 changed files with 19543 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
color.hpp
#
In color.hpp, functions related to colorizing error messages are defined.
Colors are specified using ANSI escape code.
In terminals or other output destinations that do not support ANSI escape code, the output may become difficult to read.
Macros
#
TOML11_COLORIZE_ERROR_MESSAGE
#
If this macro is defined during compilation (-DTOML11_COLORIZE_ERROR_MESASGE), error messages are colored by default.
If not defined, colors are not applied by default. You need to specify them using toml::color::enable()."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/color/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="color.hpp"><meta property="og:description" content="color.hpp # In color.hpp, functions related to colorizing error messages are defined.
Colors are specified using ANSI escape code. In terminals or other output destinations that do not support ANSI escape code, the output may become difficult to read.
Macros # TOML11_COLORIZE_ERROR_MESSAGE # If this macro is defined during compilation (-DTOML11_COLORIZE_ERROR_MESASGE), error messages are colored by default.
If not defined, colors are not applied by default. You need to specify them using toml::color::enable()."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>color.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/color/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/color/ title=color.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/color/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/ class=active>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>color.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#colorhpp>color.hpp</a><ul><li><a href=#macros>Macros</a><ul><li><a href=#toml11_colorize_error_message><code>TOML11_COLORIZE_ERROR_MESSAGE</code></a></li><li><a href=#toml11_use_thread_local_colorization><code>TOML11_USE_THREAD_LOCAL_COLORIZATION</code></a></li></ul></li><li><a href=#functions>Functions</a><ul><li><a href=#enable><code>enable()</code></a></li><li><a href=#disable><code>disable()</code></a></li><li><a href=#should_color><code>should_color()</code></a></li></ul></li><li><a href=#manipulators>Manipulators</a><ul><li></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=colorhpp>color.hpp
<a class=anchor href=#colorhpp>#</a></h1><p>In <code>color.hpp</code>, functions related to colorizing error messages are defined.</p><p>Colors are specified using ANSI escape code.
In terminals or other output destinations that do not support ANSI escape code, the output may become difficult to read.</p><h2 id=macros>Macros
<a class=anchor href=#macros>#</a></h2><h3 id=toml11_colorize_error_message><code>TOML11_COLORIZE_ERROR_MESSAGE</code>
<a class=anchor href=#toml11_colorize_error_message>#</a></h3><p>If this macro is defined during compilation (<code>-DTOML11_COLORIZE_ERROR_MESASGE</code>), error messages are colored by default.</p><p>If not defined, colors are not applied by default. You need to specify them using <code>toml::color::enable()</code>.</p><h3 id=toml11_use_thread_local_colorization><code>TOML11_USE_THREAD_LOCAL_COLORIZATION</code>
<a class=anchor href=#toml11_use_thread_local_colorization>#</a></h3><p>If this macro is defined during compilation (<code>-DTOML11_USE_THREAD_LOCAL_COLORIZATION</code>), the colorization flag becomes <code>thread_local</code>.
In this case, <code>toml::color::enable()</code> or <code>toml::color::disable()</code> will only affect the colorization flag in the thread that called it.
This means that if you want to use a different setting from the default, you will need to set it again when starting a new thread.
This makes <code>toml::color::enable()</code> and <code>toml::color::disable()</code> thread safe.</p><p>By default, the setting is global.
When it is global, if one thread executes <code>toml::color::enable()</code>, the error messages will be colored in all threads.
However, if one thread executes <code>enable()</code> or <code>disable()</code> while another executes <code>enable()</code>, <code>disable()</code> or <code>should_color()</code>, the result is undefined.</p><h2 id=functions>Functions
<a class=anchor href=#functions>#</a></h2><h3 id=enable><code>enable()</code>
<a class=anchor href=#enable>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml {
</span></span><span style=display:flex><span><span style=color:#66d9ef>namespace</span> color {
</span></span><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>enable</span>();
</span></span><span style=display:flex><span>} <span style=color:#75715e>// color
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><p>Enables colorization using ANSI escape code.</p><h4 id=example>Example
<a class=anchor href=#example>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>int</span> <span style=color:#a6e22e>main</span>()
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> toml<span style=color:#f92672>::</span>color<span style=color:#f92672>::</span>enable(); <span style=color:#75715e>// All subsequent errors will be colored.
</span></span></span><span style=display:flex><span><span style=color:#75715e></span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> input <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>parse(<span style=color:#e6db74>&#34;input.toml&#34;</span>);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#ae81ff>0</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h3 id=disable><code>disable()</code>
<a class=anchor href=#disable>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml {
</span></span><span style=display:flex><span><span style=color:#66d9ef>namespace</span> color {
</span></span><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>disable</span>();
</span></span><span style=display:flex><span>} <span style=color:#75715e>// color
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><p>Disables colorization using ANSI escape code.</p><h4 id=example-1>Example
<a class=anchor href=#example-1>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>int</span> <span style=color:#a6e22e>main</span>()
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> toml<span style=color:#f92672>::</span>color<span style=color:#f92672>::</span>disable(); <span style=color:#75715e>// All subsequent errors will not be colored.
</span></span></span><span style=display:flex><span><span style=color:#75715e></span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> input <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>parse(<span style=color:#e6db74>&#34;input.toml&#34;</span>);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#ae81ff>0</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h3 id=should_color><code>should_color()</code>
<a class=anchor href=#should_color>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml {
</span></span><span style=display:flex><span><span style=color:#66d9ef>namespace</span> color {
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>should_color</span>();
</span></span><span style=display:flex><span>} <span style=color:#75715e>// color
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><p>Returns <code>true</code> if colorization is enabled, <code>false</code> otherwise.</p><h4 id=example-2>Example
<a class=anchor href=#example-2>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;iomanip&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;iostream&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>int</span> <span style=color:#a6e22e>main</span>()
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>cout <span style=color:#f92672>&lt;&lt;</span> <span style=color:#e6db74>&#34;colorized? : &#34;</span> <span style=color:#f92672>&lt;&lt;</span> std<span style=color:#f92672>::</span>boolalpha <span style=color:#f92672>&lt;&lt;</span> toml<span style=color:#f92672>::</span>color<span style=color:#f92672>::</span>should_color() <span style=color:#f92672>&lt;&lt;</span> std<span style=color:#f92672>::</span>endl;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#ae81ff>0</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=manipulators>Manipulators
<a class=anchor href=#manipulators>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml {
</span></span><span style=display:flex><span><span style=color:#66d9ef>namespace</span> color {
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> reset (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> bold (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> grey (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> gray (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> red (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> green (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> yellow (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> blue (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> magenta(std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> cyan (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> white (std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span>} <span style=color:#75715e>// color
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><p>Colorizes the foreground with ANSI escape code.</p><h4 id=example-3>Example
<a class=anchor href=#example-3>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;iostream&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>int</span> <span style=color:#a6e22e>main</span>()
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>cout <span style=color:#f92672>&lt;&lt;</span> toml<span style=color:#f92672>::</span>color<span style=color:#f92672>::</span>red <span style=color:#f92672>&lt;&lt;</span> <span style=color:#e6db74>&#34;red!&#34;</span> <span style=color:#f92672>&lt;&lt;</span> toml<span style=color:#f92672>::</span>color<span style=color:#f92672>::</span>reset <span style=color:#f92672>&lt;&lt;</span> std<span style=color:#f92672>::</span>endl;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#ae81ff>0</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/error_info/>error_info.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#colorhpp>color.hpp</a><ul><li><a href=#macros>Macros</a><ul><li><a href=#toml11_colorize_error_message><code>TOML11_COLORIZE_ERROR_MESSAGE</code></a></li><li><a href=#toml11_use_thread_local_colorization><code>TOML11_USE_THREAD_LOCAL_COLORIZATION</code></a></li></ul></li><li><a href=#functions>Functions</a><ul><li><a href=#enable><code>enable()</code></a></li><li><a href=#disable><code>disable()</code></a></li><li><a href=#should_color><code>should_color()</code></a></li></ul></li><li><a href=#manipulators>Manipulators</a><ul><li></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,52 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
conversion.hpp
#
Provides macros to automatically define conversion functions for supporting user-defined types with toml::get and toml::find.
TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(NAME, ...)
Example
#
namespace foo
{
struct Foo
{
std::string s;
double d;
int i;
};
} // foo
TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(foo::Foo, s, d, i)
Related
#
from.hpp
into.hpp
"><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/conversion/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="conversion.hpp"><meta property="og:description" content="conversion.hpp # Provides macros to automatically define conversion functions for supporting user-defined types with toml::get and toml::find.
TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(NAME, ...) Example # namespace foo { struct Foo { std::string s; double d; int i; }; } // foo TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(foo::Foo, s, d, i) Related # from.hpp into.hpp"><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>conversion.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/conversion/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/conversion/ title=conversion.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/conversion/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/ class=active>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>conversion.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#conversionhpp>conversion.hpp</a><ul><li><a href=#example>Example</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=conversionhpp>conversion.hpp
<a class=anchor href=#conversionhpp>#</a></h1><p>Provides macros to automatically define conversion functions for supporting user-defined types with <code>toml::get</code> and <code>toml::find</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(NAME, ...)
</span></span></code></pre></div><h2 id=example>Example
<a class=anchor href=#example>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> foo
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>Foo</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string s;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>double</span> d;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>int</span> i;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>} <span style=color:#75715e>// foo
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span>TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(foo<span style=color:#f92672>::</span>Foo, s, d, i)
</span></span></code></pre></div><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/from/>from.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/into/>into.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#conversionhpp>conversion.hpp</a><ul><li><a href=#example>Example</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,120 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content='
error_info.hpp
#
In error_info.hpp, definitions for error_info and functions to format it are provided.
toml::error_info
#
namespace toml
{
struct error_info
{
error_info(std::string t, source_location l, std::string m, std::string s = "");
error_info(std::string t, std::vector<std::pair<source_location, std::string>> l, std::string s = "");
std::string const& title() const noexcept;
std::string & title() noexcept;
std::vector<std::pair<source_location, std::string>> const& locations() const noexcept;
void add_locations(source_location loc, std::string msg) noexcept;
std::string const& suffix() const noexcept;
std::string & suffix() noexcept;
};
template<typename ... Ts>
error_info make_error_info(
std::string title, source_location loc, std::string msg, Ts&& ... tail);
std::string format_error(const std::string& errkind, const error_info& err);
std::string format_error(const error_info& err);
template<typename ... Ts>
std::string format_error(std::string title,
source_location loc, std::string msg, Ts&& ... tail);
std::ostream& operator<<(std::ostream& os, const error_info& e);
}
Member Functions
#
Constructor (title, loc, msg, suffix)
#
Constructs error_info with specified title, location information loc, message msg, and optional suffix.'><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/error_info/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="error_info.hpp"><meta property="og:description" content='error_info.hpp # In error_info.hpp, definitions for error_info and functions to format it are provided.
toml::error_info # namespace toml { struct error_info { error_info(std::string t, source_location l, std::string m, std::string s = ""); error_info(std::string t, std::vector<std::pair<source_location, std::string>> l, std::string s = ""); std::string const& title() const noexcept; std::string & title() noexcept; std::vector<std::pair<source_location, std::string>> const& locations() const noexcept; void add_locations(source_location loc, std::string msg) noexcept; std::string const& suffix() const noexcept; std::string & suffix() noexcept; }; template<typename ... Ts> error_info make_error_info( std::string title, source_location loc, std::string msg, Ts&& ... tail); std::string format_error(const std::string& errkind, const error_info& err); std::string format_error(const error_info& err); template<typename ... Ts> std::string format_error(std::string title, source_location loc, std::string msg, Ts&& ... tail); std::ostream& operator<<(std::ostream& os, const error_info& e); } Member Functions # Constructor (title, loc, msg, suffix) # Constructs error_info with specified title, location information loc, message msg, and optional suffix.'><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>error_info.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/error_info/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/error_info/ title=error_info.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/error_info/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/ class=active>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>error_info.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#error_infohpp>error_info.hpp</a></li><li><a href=#tomlerror_info><code>toml::error_info</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor-title-loc-msg-suffix>Constructor (<code>title, loc, msg, suffix</code>)</a></li><li><a href=#constructor-title-loc-msg--suffix>Constructor (<code>title, [{loc, msg}, ...], suffix</code>)</a></li><li><a href=#stdstring-title><code>std::string title()</code></a></li><li><a href=#stdvectorstdpairsource_location-stdstring-locations><code>std::vector&lt;std::pair&lt;source_location, std::string>> locations()</code></a></li><li><a href=#stdstring-suffix><code>std::string suffix()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#make_error_info><code>make_error_info</code></a></li><li><a href=#format_error><code>format_error</code></a></li><li><a href=#stream-operator>Stream Operator</a></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=error_infohpp>error_info.hpp
<a class=anchor href=#error_infohpp>#</a></h1><p>In <code>error_info.hpp</code>, definitions for <code>error_info</code> and functions to format it are provided.</p><h1 id=tomlerror_info><code>toml::error_info</code>
<a class=anchor href=#tomlerror_info>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>error_info</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> error_info(std<span style=color:#f92672>::</span>string t, source_location l, std<span style=color:#f92672>::</span>string m, std<span style=color:#f92672>::</span>string s <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;&#34;</span>);
</span></span><span style=display:flex><span> error_info(std<span style=color:#f92672>::</span>string t, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>pair<span style=color:#f92672>&lt;</span>source_location, std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;&gt;</span> l, std<span style=color:#f92672>::</span>string s <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;&#34;</span>);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> title() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#f92672>&amp;</span> title() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>pair<span style=color:#f92672>&lt;</span>source_location, std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> locations() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>add_locations</span>(source_location loc, std<span style=color:#f92672>::</span>string msg) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> suffix() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#f92672>&amp;</span> suffix() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>error_info make_error_info(
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string title, source_location loc, std<span style=color:#f92672>::</span>string msg, Ts<span style=color:#f92672>&amp;&amp;</span> ... tail);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_error(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> errkind, <span style=color:#66d9ef>const</span> error_info<span style=color:#f92672>&amp;</span> err);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_error(<span style=color:#66d9ef>const</span> error_info<span style=color:#f92672>&amp;</span> err);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_error(std<span style=color:#f92672>::</span>string title,
</span></span><span style=display:flex><span> source_location loc, std<span style=color:#f92672>::</span>string msg, Ts<span style=color:#f92672>&amp;&amp;</span> ... tail);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;&lt;</span>(std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> os, <span style=color:#66d9ef>const</span> error_info<span style=color:#f92672>&amp;</span> e);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=member-functions>Member Functions
<a class=anchor href=#member-functions>#</a></h2><h3 id=constructor-title-loc-msg-suffix>Constructor (<code>title, loc, msg, suffix</code>)
<a class=anchor href=#constructor-title-loc-msg-suffix>#</a></h3><p>Constructs <code>error_info</code> with specified <code>title</code>, location information <code>loc</code>, message <code>msg</code>, and optional <code>suffix</code>.</p><p><code>suffix</code> defaults to empty.</p><h3 id=constructor-title-loc-msg--suffix>Constructor (<code>title, [{loc, msg}, ...], suffix</code>)
<a class=anchor href=#constructor-title-loc-msg--suffix>#</a></h3><p>Constructs <code>error_info</code> with specified <code>title</code>, an array of location-message pairs <code>[{loc, msg}, ...]</code>, and optional <code>suffix</code>.</p><p><code>suffix</code> defaults to empty.</p><h3 id=stdstring-title><code>std::string title()</code>
<a class=anchor href=#stdstring-title>#</a></h3><p>Returns the title of the error message.</p><h3 id=stdvectorstdpairsource_location-stdstring-locations><code>std::vector&lt;std::pair&lt;source_location, std::string>> locations()</code>
<a class=anchor href=#stdvectorstdpairsource_location-stdstring-locations>#</a></h3><p>Returns the list of locations where errors occurred along with their respective messages.</p><p>Multiple locations can be specified.</p><h3 id=stdstring-suffix><code>std::string suffix()</code>
<a class=anchor href=#stdstring-suffix>#</a></h3><p>Returns the suffix message to display at the end, providing hints or additional information.</p><h2 id=non-member-functions>Non-Member Functions
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=make_error_info><code>make_error_info</code>
<a class=anchor href=#make_error_info>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>error_info make_error_info(
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string title, source_location loc, std<span style=color:#f92672>::</span>string msg, Ts<span style=color:#f92672>&amp;&amp;</span> ... tail);
</span></span></code></pre></div><p>Creates a new <code>error_info</code>.</p><p>Must be followed by a <code>msg</code> related to <code>source_location</code> or <code>basic_value</code>.</p><p>Overloads are added in <a href=https://toruniina.github.io/toml11/docs/reference/value/#tomlmake_error_info><code>value.hpp</code></a> when passing <code>toml::basic_value</code> instead of <code>source_location</code>.</p><p>Possible to pass <code>suffix</code> at the end.</p><h3 id=format_error><code>format_error</code>
<a class=anchor href=#format_error>#</a></h3><p>Formats <code>error_info</code> as follows:</p><pre tabindex=0><code>{title}
--&gt; {locations().at(0).first.file_name()}
|
1 | {locations().at(0).first.line()}
| ^-- {locations().at(0).second}
|
2 | {locations().at(1).first.line()}
| ^-- {locations().at(1).second}
{suffix}
</code></pre><p>If file names differ between two <code>source_location</code>, the file name is displayed again.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_error(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> errkind, <span style=color:#66d9ef>const</span> error_info<span style=color:#f92672>&amp;</span> err);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_error(<span style=color:#66d9ef>const</span> error_info<span style=color:#f92672>&amp;</span> err);
</span></span></code></pre></div><p>Formats <code>error_info</code>.</p><p>If <code>errkind</code> is not provided, a red-bold <code>[error]</code> prefix is added before <code>title</code>.</p><p>If <code>errkind</code> is provided (including an empty string), it replaces <code>[error]</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_error(std<span style=color:#f92672>::</span>string title,
</span></span><span style=display:flex><span> source_location loc, std<span style=color:#f92672>::</span>string msg, Ts<span style=color:#f92672>&amp;&amp;</span> ... tail);
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><p>Returns a formatted string using <code>format_error</code> for <code>error_info</code> created with <code>make_error_info</code>.</p><p>Overloads are added in <a href=https://toruniina.github.io/toml11/docs/reference/value/#tomlformat_error><code>value.hpp</code></a> when passing <code>toml::basic_value</code> instead of <code>source_location</code>.</p><h3 id=stream-operator>Stream Operator
<a class=anchor href=#stream-operator>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;&lt;</span>(std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> os, <span style=color:#66d9ef>const</span> error_info<span style=color:#f92672>&amp;</span> e);
</span></span></code></pre></div><p>Calls <code>format_error(e)</code> and outputs it.</p><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/color/>color.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/source_location/>source_location.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#error_infohpp>error_info.hpp</a></li><li><a href=#tomlerror_info><code>toml::error_info</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor-title-loc-msg-suffix>Constructor (<code>title, loc, msg, suffix</code>)</a></li><li><a href=#constructor-title-loc-msg--suffix>Constructor (<code>title, [{loc, msg}, ...], suffix</code>)</a></li><li><a href=#stdstring-title><code>std::string title()</code></a></li><li><a href=#stdvectorstdpairsource_location-stdstring-locations><code>std::vector&lt;std::pair&lt;source_location, std::string>> locations()</code></a></li><li><a href=#stdstring-suffix><code>std::string suffix()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#make_error_info><code>make_error_info</code></a></li><li><a href=#format_error><code>format_error</code></a></li><li><a href=#stream-operator>Stream Operator</a></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,59 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content='
exception.hpp
#
toml::exception
#
Base class for exception types defined in toml11.
namespace toml
{
struct exception : public std::exception
{
public:
virtual ~exception() noexcept override = default;
virtual const char* what() const noexcept override {return "";}
};
} // toml
Member Functions
#
Destructor
#
virtual ~exception() noexcept override = default;
Override when derived.
what
#
virtual const char* what() const noexcept override {return "";}
Returns the error message. Override when derived.'><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/exception/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="exception.hpp"><meta property="og:description" content='exception.hpp # toml::exception # Base class for exception types defined in toml11.
namespace toml { struct exception : public std::exception { public: virtual ~exception() noexcept override = default; virtual const char* what() const noexcept override {return "";} }; } // toml Member Functions # Destructor # virtual ~exception() noexcept override = default; Override when derived.
what # virtual const char* what() const noexcept override {return "";} Returns the error message. Override when derived.'><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>exception.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/exception/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/exception/ title=exception.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/exception/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/ class=active>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>exception.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#exceptionhpp>exception.hpp</a></li><li><a href=#tomlexception><code>toml::exception</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#destructor>Destructor</a></li><li><a href=#what><code>what</code></a></li></ul></li></ul></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=exceptionhpp>exception.hpp
<a class=anchor href=#exceptionhpp>#</a></h1><h1 id=tomlexception><code>toml::exception</code>
<a class=anchor href=#tomlexception>#</a></h1><p>Base class for exception types defined in toml11.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>exception</span> <span style=color:#f92672>:</span> <span style=color:#66d9ef>public</span> std<span style=color:#f92672>::</span>exception
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>public</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>virtual</span> <span style=color:#f92672>~</span>exception() <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>virtual</span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>what</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;&#34;</span>;}
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h2 id=member-functions>Member Functions
<a class=anchor href=#member-functions>#</a></h2><h3 id=destructor>Destructor
<a class=anchor href=#destructor>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>virtual</span> <span style=color:#f92672>~</span>exception() <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span></code></pre></div><p>Override when derived.</p><h3 id=what><code>what</code>
<a class=anchor href=#what>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>virtual</span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>what</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;&#34;</span>;}
</span></span></code></pre></div><p>Returns the error message. Override when derived.</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#exceptionhpp>exception.hpp</a></li><li><a href=#tomlexception><code>toml::exception</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#destructor>Destructor</a></li><li><a href=#what><code>what</code></a></li></ul></li></ul></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,132 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
find.hpp
#
This function searches for a value in a toml::value and performs type conversion if necessary.
toml::value can change the type it stores, and toml::find accommodates these types.
Technically, all functions use toml::basic_value<TC>.
However, for simplicity, we refer to it as toml::value in explanations unless a distinction is necessary.
In the documentation, if the template parameter TC changes the type, assume that types like toml::value::integer_type will also change accordingly.
toml::find
#
Overview
#
toml::find uses template arguments for the type you want to retrieve and function arguments for the key of the value you want to find."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/find/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="find.hpp"><meta property="og:description" content="find.hpp # This function searches for a value in a toml::value and performs type conversion if necessary.
toml::value can change the type it stores, and toml::find accommodates these types. Technically, all functions use toml::basic_value<TC>. However, for simplicity, we refer to it as toml::value in explanations unless a distinction is necessary. In the documentation, if the template parameter TC changes the type, assume that types like toml::value::integer_type will also change accordingly. toml::find # Overview # toml::find uses template arguments for the type you want to retrieve and function arguments for the key of the value you want to find."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>find.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/find/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/find/ title=find.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/find/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/ class=active>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>find.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#findhpp>find.hpp</a></li><li><a href=#tomlfind><code>toml::find</code></a><ul><li><a href=#overview>Overview</a><ul><li><a href=#note-on-recursive-search>Note on Recursive Search</a></li></ul></li><li><a href=#tomlfindvalue-key><code>toml::find(value, key)</code></a><ul><li><a href=#exceptions>Exceptions</a></li></ul></li><li><a href=#tomlfindvalue-index><code>toml::find(value, index)</code></a><ul><li><a href=#exceptions-1>Exceptions</a></li></ul></li><li><a href=#tomlfindvalue-keys><code>toml::find(value, keys...)</code></a></li></ul></li><li><a href=#tomlfind_orvalue-key-fallback><code>toml::find_or(value, key, fallback)</code></a><ul><li><a href=#when-t-is-basic_value>When <code>T</code> is <code>basic_value</code></a></li><li><a href=#when-t-is-tomlvaluesome_type>When <code>T</code> is <code>toml::value::{some_type}</code></a></li><li><a href=#when-t-is-const-char>When <code>T</code> is <code>const char*</code></a></li><li><a href=#when-t-is-any-other-type>When <code>T</code> is any other type</a></li><li><a href=#when-multiple-keys-are-provided>When multiple keys are provided</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=findhpp>find.hpp
<a class=anchor href=#findhpp>#</a></h1><p>This function searches for a value in a <code>toml::value</code> and performs type conversion if necessary.</p><blockquote class="book-hint info"><code>toml::value</code> can change the type it stores, and <code>toml::find</code> accommodates these types.
Technically, all functions use <code>toml::basic_value&lt;TC></code>.
However, for simplicity, we refer to it as <code>toml::value</code> in explanations unless a distinction is necessary.
In the documentation, if the template parameter <code>TC</code> changes the type, assume that types like <code>toml::value::integer_type</code> will also change accordingly.</blockquote><h1 id=tomlfind><code>toml::find</code>
<a class=anchor href=#tomlfind>#</a></h1><h2 id=overview>Overview
<a class=anchor href=#overview>#</a></h2><p><code>toml::find</code> uses template arguments for the type you want to retrieve and function arguments for the key of the value you want to find.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> ... Keys<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T find(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, Keys ... keys);
</span></span></code></pre></div><p>The supported types for <code>T</code> and the behavior of the conversion are the same as for <code>toml::get</code>.</p><p>If <code>T</code> is not specified, a <code>toml::value</code> will be returned.</p><p>Keys can be of type <code>toml::value::key_type</code> or <code>std::size_t</code>.
When multiple keys are provided, the function will search recursively through sub-tables or arrays.
If a <code>toml::value::key_type</code> is given, <code>toml::value</code> is interpreted as a <code>toml::table</code>; if a <code>std::size_t</code> is given, <code>toml::value</code> is interpreted as a <code>toml::array</code>.</p><h3 id=note-on-recursive-search>Note on Recursive Search
<a class=anchor href=#note-on-recursive-search>#</a></h3><p>TOML allows for bare keys as well as quoted keys (enclosed in <code>"</code> or <code>'</code>). Using a quoted key like <code>"foo.bar" = "baz"</code> means no sub-table is constructed, and the key is <code>"foo.bar"</code>. To handle such patterns, toml11 does not split keys containing <code>.</code> and searches using the full string.</p><p>Consider the following TOML file:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-toml data-lang=toml><span style=display:flex><span>[<span style=color:#a6e22e>foo</span>]
</span></span><span style=display:flex><span>[<span style=color:#a6e22e>foo</span>.<span style=color:#a6e22e>bar</span>]
</span></span><span style=display:flex><span><span style=color:#a6e22e>baz</span> = <span style=color:#e6db74>&#34;hoge&#34;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>[<span style=color:#e6db74>&#34;foo.bar&#34;</span>]
</span></span><span style=display:flex><span><span style=color:#a6e22e>baz</span> = <span style=color:#e6db74>&#34;fuga&#34;</span>
</span></span></code></pre></div><p>The corresponding usage of <code>toml::find</code> is shown below:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> input <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>parse(<span style=color:#e6db74>&#34;input.toml&#34;</span>);
</span></span><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> baz1 <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>find<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span>(input, <span style=color:#e6db74>&#34;foo&#34;</span>, <span style=color:#e6db74>&#34;bar&#34;</span>, <span style=color:#e6db74>&#34;baz&#34;</span>); <span style=color:#75715e>// hoge
</span></span></span><span style=display:flex><span><span style=color:#75715e></span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> baz2 <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>find<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span>(input, <span style=color:#e6db74>&#34;foo.bar&#34;</span>, <span style=color:#e6db74>&#34;baz&#34;</span>); <span style=color:#75715e>// fuga
</span></span></span></code></pre></div><p>cf. <a href=https://toml.io/en/v1.0.0#keys>toml.io/en/v1.0.0#keys</a></p><h2 id=tomlfindvalue-key><code>toml::find(value, key)</code>
<a class=anchor href=#tomlfindvalue-key>#</a></h2><p>Searches for <code>key</code> in <code>value</code> as if <code>value</code> were a <code>toml::table</code>, then converts using <code>toml::get</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(const value&amp;) */</span> find(
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&amp;</span> ky);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(value&amp;) */</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&amp;</span> ky);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(value&amp;&amp;) */</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&amp;</span> ky);
</span></span></code></pre></div><p>If <code>T</code> is not specified, the function returns a <code>toml::value</code> without conversion.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> v, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&amp;</span> ky);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&amp;</span> ky);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&amp;</span> ky);
</span></span></code></pre></div><h3 id=exceptions>Exceptions
<a class=anchor href=#exceptions>#</a></h3><p>If the <code>toml::value</code> does not contain a <code>table</code>, a <code>toml::type_error</code> is thrown.</p><p>If the contained <code>table</code> does not have the specified element, a <code>std::out_of_range</code> is thrown.</p><p>If the specified element cannot be converted to <code>T</code> (i.e., <code>toml::get</code> fails), a <code>toml::type_error</code> is thrown.</p><h2 id=tomlfindvalue-index><code>toml::find(value, index)</code>
<a class=anchor href=#tomlfindvalue-index>#</a></h2><p>Accesses the <code>index</code>-th element of <code>value</code> as if <code>value</code> were a <code>toml::array</code>, then converts using <code>toml::get</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(const value&amp;) */</span> find(
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t index);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(value&amp;) */</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t index);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(value&amp;&amp;) */</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t index);
</span></span></code></pre></div><p>If <code>T</code> is not specified, the function returns a <code>toml::value</code> without conversion.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> find(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> v, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t ky);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> find(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t ky);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> find(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t ky);
</span></span></code></pre></div><h3 id=exceptions-1>Exceptions
<a class=anchor href=#exceptions-1>#</a></h3><p>If the <code>toml::value</code> does not contain an <code>array</code>, a <code>toml::type_error</code> is thrown.</p><p>If the contained <code>array</code> does not have the specified number of elements, a <code>std::out_of_range</code> is thrown.</p><p>If the specified element cannot be converted to <code>T</code> (i.e., <code>toml::get</code> fails), a <code>toml::type_error</code> is thrown.</p><h2 id=tomlfindvalue-keys><code>toml::find(value, keys...)</code>
<a class=anchor href=#tomlfindvalue-keys>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K1, <span style=color:#66d9ef>typename</span> K2, <span style=color:#66d9ef>typename</span> ... Ks<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(const value&amp;) */</span> find(
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K1<span style=color:#f92672>&amp;</span> k1, <span style=color:#66d9ef>const</span> K2<span style=color:#f92672>&amp;</span> k2, <span style=color:#66d9ef>const</span> Ks<span style=color:#f92672>&amp;</span> ... ks);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K1, <span style=color:#66d9ef>typename</span> K2, <span style=color:#66d9ef>typename</span> ... Ks<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(value&amp;) */</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K1<span style=color:#f92672>&amp;</span> k1, <span style=color:#66d9ef>const</span> K2<span style=color:#f92672>&amp;</span> k2, <span style=color:#66d9ef>const</span> Ks<span style=color:#f92672>&amp;</span> ... ks);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K1, <span style=color:#66d9ef>typename</span> K2, <span style=color:#66d9ef>typename</span> ... Ks<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Equivalent to toml::get&lt;T&gt;(value&amp;&amp;) */</span> find(
</span></span><span style=display:flex><span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v, <span style=color:#66d9ef>const</span> K1<span style=color:#f92672>&amp;</span> k1, <span style=color:#66d9ef>const</span> K2<span style=color:#f92672>&amp;</span> k2, <span style=color:#66d9ef>const</span> Ks<span style=color:#f92672>&amp;</span> ... ks);
</span></span></code></pre></div><p>This function calls <code>toml::find</code> recursively.</p><p>The failure conditions and the exceptions thrown are the same as those for <code>toml::find</code>.</p><h1 id=tomlfind_orvalue-key-fallback><code>toml::find_or(value, key, fallback)</code>
<a class=anchor href=#tomlfind_orvalue-key-fallback>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> Key<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T find_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> Key<span style=color:#f92672>&amp;</span> key, T<span style=color:#f92672>&amp;&amp;</span> opt);
</span></span></code></pre></div><p>The <code>find_or</code> function takes a default value to avoid throwing an exception when the search fails.</p><p>The default value must be of the same type as the return type <code>T</code>. Therefore, unlike <code>toml::find&lt;T></code>, <code>find_or</code> infers the type <code>T</code>.</p><p>You can specify <code>T</code> explicitly with <code>find_or&lt;T></code>, but this always returns a new value. To obtain a reference, do not specify <code>T</code>.</p><h2 id=when-t-is-basic_value>When <code>T</code> is <code>basic_value</code>
<a class=anchor href=#when-t-is-basic_value>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> find_or(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K<span style=color:#f92672>&amp;</span> key, basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> find_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K<span style=color:#f92672>&amp;</span> key, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>
</span></span></code></pre></div><p>Searches for the corresponding value and returns it without conversion. Because no conversion is needed, a reference can be returned.</p><p>If the value is not found, the default value is returned.</p><h2 id=when-t-is-tomlvaluesome_type>When <code>T</code> is <code>toml::value::{some_type}</code>
<a class=anchor href=#when-t-is-tomlvaluesome_type>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T<span style=color:#f92672>&amp;</span> find_or(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K<span style=color:#f92672>&amp;</span> key, T<span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> find_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K<span style=color:#f92672>&amp;</span> key, <span style=color:#66d9ef>const</span> T<span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>
</span></span></code></pre></div><p>Searches for the corresponding value and returns it without conversion. Because no conversion is needed, a reference can be returned.</p><p>If the value is not found or if a different type is stored, the default value is returned.</p><h2 id=when-t-is-const-char>When <code>T</code> is <code>const char*</code>
<a class=anchor href=#when-t-is-const-char>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T find_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K<span style=color:#f92672>&amp;</span> key, T opt)
</span></span></code></pre></div><p>Searches for the corresponding value and returns it as a <code>std::string</code>.</p><p>Since the fallback is constructed from <code>const char*</code> to <code>std::string</code>, a reference cannot be returned in case of failure.</p><h2 id=when-t-is-any-other-type>When <code>T</code> is any other type
<a class=anchor href=#when-t-is-any-other-type>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> K<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T find_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> K<span style=color:#f92672>&amp;</span> key, T opt);
</span></span></code></pre></div><p>Searches for the corresponding value and converts it to <code>T</code> before returning it.</p><p>Because conversion is performed, a reference cannot be returned.</p><h2 id=when-multiple-keys-are-provided>When multiple keys are provided
<a class=anchor href=#when-multiple-keys-are-provided>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> Value, <span style=color:#66d9ef>typename</span> K1, <span style=color:#66d9ef>typename</span> K2, <span style=color:#66d9ef>typename</span> K3, <span style=color:#66d9ef>typename</span> ... Ks<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>auto</span> find_or(Value<span style=color:#f92672>&amp;&amp;</span> v, <span style=color:#66d9ef>const</span> K1<span style=color:#f92672>&amp;</span> k1, <span style=color:#66d9ef>const</span> K2<span style=color:#f92672>&amp;</span> k2, K3<span style=color:#f92672>&amp;&amp;</span> k3, Ks<span style=color:#f92672>&amp;&amp;</span> ... keys) <span style=color:#66d9ef>noexcept</span>
</span></span><span style=display:flex><span> <span style=color:#f92672>-&gt;</span> <span style=color:#66d9ef>decltype</span>(find_or(v, k2, std<span style=color:#f92672>::</span>forward<span style=color:#f92672>&lt;</span>K3<span style=color:#f92672>&gt;</span>(k3), std<span style=color:#f92672>::</span>forward<span style=color:#f92672>&lt;</span>Ks<span style=color:#f92672>&gt;</span>(keys)...))
</span></span></code></pre></div><p>Interprets the last element in the key sequence as the default value and applies <code>find_or</code> recursively.</p><p>If the inferred type of <code>T</code> is <code>toml::value</code> or <code>toml::value::some_type</code>, a reference can be returned.</p><p>If <code>T</code> is explicitly specified, conversion is always performed.</p><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/get/>get.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/value/>value.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#findhpp>find.hpp</a></li><li><a href=#tomlfind><code>toml::find</code></a><ul><li><a href=#overview>Overview</a><ul><li><a href=#note-on-recursive-search>Note on Recursive Search</a></li></ul></li><li><a href=#tomlfindvalue-key><code>toml::find(value, key)</code></a><ul><li><a href=#exceptions>Exceptions</a></li></ul></li><li><a href=#tomlfindvalue-index><code>toml::find(value, index)</code></a><ul><li><a href=#exceptions-1>Exceptions</a></li></ul></li><li><a href=#tomlfindvalue-keys><code>toml::find(value, keys...)</code></a></li></ul></li><li><a href=#tomlfind_orvalue-key-fallback><code>toml::find_or(value, key, fallback)</code></a><ul><li><a href=#when-t-is-basic_value>When <code>T</code> is <code>basic_value</code></a></li><li><a href=#when-t-is-tomlvaluesome_type>When <code>T</code> is <code>toml::value::{some_type}</code></a></li><li><a href=#when-t-is-const-char>When <code>T</code> is <code>const char*</code></a></li><li><a href=#when-t-is-any-other-type>When <code>T</code> is any other type</a></li><li><a href=#when-multiple-keys-are-provided>When multiple keys are provided</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,92 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content='
from.hpp
#
Defines a struct used for conversion from toml::value in toml::get and toml::find.
You can achieve the same functionality by adding a from_toml member function, but for classes where you cannot add member functions, use from<T>.
This file does not provide specific implementations. Please specialize this struct when using.
namespace toml
{
template<typename T>
struct from;
} // toml
Example
#
namespace extlib
{
struct foo
{
int a;
std::string b;
};
} // extlib
#include <toml11/from.hpp>
namespace toml
{
template<>
struct from<extlib::foo>
{
template<typename TC>
static extlib::foo from_toml(const toml::basic_value<TC>& v)
{
return extlib::foo{toml::find<int>(v, "a"), toml::find<std::string>(v, "b")};
}
};
} // toml
Related
#
conversion.hpp
into.hpp
'><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/from/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="from.hpp"><meta property="og:description" content='from.hpp # Defines a struct used for conversion from toml::value in toml::get and toml::find.
You can achieve the same functionality by adding a from_toml member function, but for classes where you cannot add member functions, use from<T>.
This file does not provide specific implementations. Please specialize this struct when using.
namespace toml { template<typename T> struct from; } // toml Example # namespace extlib { struct foo { int a; std::string b; }; } // extlib #include <toml11/from.hpp> namespace toml { template<> struct from<extlib::foo> { template<typename TC> static extlib::foo from_toml(const toml::basic_value<TC>& v) { return extlib::foo{toml::find<int>(v, "a"), toml::find<std::string>(v, "b")}; } }; } // toml Related # conversion.hpp into.hpp'><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>from.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/from/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/from/ title=from.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/from/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/ class=active>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>from.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#fromhpp>from.hpp</a><ul><li><a href=#example>Example</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=fromhpp>from.hpp
<a class=anchor href=#fromhpp>#</a></h1><p>Defines a <code>struct</code> used for conversion from <code>toml::value</code> in <code>toml::get</code> and <code>toml::find</code>.</p><p>You can achieve the same functionality by adding a <code>from_toml</code> member function, but for classes where you cannot add member functions, use <code>from&lt;T></code>.</p><p>This file does not provide specific implementations. Please specialize this <code>struct</code> when using.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>from</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h2 id=example>Example
<a class=anchor href=#example>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> extlib
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>foo</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>int</span> a;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string b;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>} <span style=color:#75715e>// extlib
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml11/from.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>from</span><span style=color:#f92672>&lt;</span>extlib<span style=color:#f92672>::</span>foo<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>static</span> extlib<span style=color:#f92672>::</span>foo from_toml(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v)
</span></span><span style=display:flex><span> {
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> extlib<span style=color:#f92672>::</span>foo{toml<span style=color:#f92672>::</span>find<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>int</span><span style=color:#f92672>&gt;</span>(v, <span style=color:#e6db74>&#34;a&#34;</span>), toml<span style=color:#f92672>::</span>find<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span>(v, <span style=color:#e6db74>&#34;b&#34;</span>)};
</span></span><span style=display:flex><span> }
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/into/>into.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#fromhpp>from.hpp</a><ul><li><a href=#example>Example</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,141 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
get.hpp
#
These are functions for extracting values from toml::value and performing type conversions if necessary.
toml::value can change the type it stores, and toml::get accommodates these types.
Technically, all functions use toml::basic_value<TC>.
However, for simplicity, we refer to it as toml::value in explanations unless a distinction is necessary.
In the documentation, if the template parameter TC changes the type, assume that types like toml::value::integer_type will also change accordingly.
toml::get<T>
#
Overview
#
Generally, toml::get behaves as follows:
You specify T as in toml::get<int>(v)."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/get/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="get.hpp"><meta property="og:description" content="get.hpp # These are functions for extracting values from toml::value and performing type conversions if necessary.
toml::value can change the type it stores, and toml::get accommodates these types. Technically, all functions use toml::basic_value<TC>. However, for simplicity, we refer to it as toml::value in explanations unless a distinction is necessary. In the documentation, if the template parameter TC changes the type, assume that types like toml::value::integer_type will also change accordingly. toml::get<T> # Overview # Generally, toml::get behaves as follows: You specify T as in toml::get<int>(v)."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>get.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/get/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/get/ title=get.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/get/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/ class=active>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>get.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#gethpp>get.hpp</a></li><li><a href=#tomlgett><code>toml::get&lt;T></code></a><ul><li><a href=#overview>Overview</a><ul><li><a href=#types-that-do-not-require-conversion>Types that Do Not Require Conversion</a></li><li><a href=#types-that-require-conversion>Types that Require Conversion</a></li><li><a href=#when-conversion-fails>When Conversion Fails</a></li></ul></li><li><a href=#when-t-is-identical-to-tomlvalue>When <code>T</code> is identical to <code>toml::value</code></a></li><li><a href=#when-t-is-one-of-tomlvaluesome_type>When <code>T</code> is one of <code>toml::value::{some_type}</code></a></li><li><a href=#when-t-is-basic_valueothertc-with-a-different-typeconfig>When <code>T</code> is <code>basic_value&lt;OtherTC></code> with a different <code>TypeConfig</code></a></li><li><a href=#when-t-is-an-integer-type>When <code>T</code> is an integer type</a></li><li><a href=#when-t-is-a-floating-point-type>When <code>T</code> is a floating-point type</a></li><li><a href=#when-t-is-stdstring_view>When <code>T</code> is <code>std::string_view</code></a></li><li><a href=#when-t-is-stdchronoduration>When <code>T</code> is <code>std::chrono::duration</code></a></li><li><a href=#when-t-is-stdchronosystem_clocktime_point>When <code>T</code> is <code>std::chrono::system_clock::time_point</code></a></li><li><a href=#when-t-is-array-like>When <code>T</code> is array-like</a></li><li><a href=#when-t-is-stdarray>When <code>T</code> is <code>std::array</code></a></li><li><a href=#when-t-is-stdforward_list>When <code>T</code> is <code>std::forward_list</code></a></li><li><a href=#when-t-is-stdpair>When <code>T</code> is <code>std::pair</code></a></li><li><a href=#when-t-is-stdtuple>When <code>T</code> is <code>std::tuple</code></a></li><li><a href=#when-t-is-map-like>When <code>T</code> is map-like</a></li><li><a href=#when-t-is-a-user-defined-type-with-a-specialization-of-tomlfromt>When <code>T</code> is a user-defined type with a specialization of <code>toml::from&lt;T></code></a></li><li><a href=#when-t-is-a-user-defined-type-with-a-from_toml-member-function>When <code>T</code> is a user-defined type with a <code>from_toml</code> member function</a></li><li><a href=#when-t-is-a-user-defined-type-with-a-constructor-that-takes-tomlbasic_valuetc>When <code>T</code> is a user-defined type with a constructor that takes <code>toml::basic_value&lt;TC></code></a></li></ul></li><li><a href=#tomlget_ort><code>toml::get_or&lt;T></code></a><ul><li><a href=#when-t-is-basic_valuetc>When <code>T</code> is <code>basic_value&lt;TC></code></a></li><li><a href=#when-t-is-basic_valuetcsome_type>When <code>T</code> is <code>basic_value&lt;TC>::{some_type}</code></a></li><li><a href=#when-t-is-const-char>When <code>T</code> is <code>const char*</code></a></li><li><a href=#when-t-is-something-else>When <code>T</code> is something else</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=gethpp>get.hpp
<a class=anchor href=#gethpp>#</a></h1><p>These are functions for extracting values from <code>toml::value</code> and performing type conversions if necessary.</p><blockquote class="book-hint info"><code>toml::value</code> can change the type it stores, and <code>toml::get</code> accommodates these types.
Technically, all functions use <code>toml::basic_value&lt;TC></code>.
However, for simplicity, we refer to it as <code>toml::value</code> in explanations unless a distinction is necessary.
In the documentation, if the template parameter <code>TC</code> changes the type, assume that types like <code>toml::value::integer_type</code> will also change accordingly.</blockquote><h1 id=tomlgett><code>toml::get&lt;T></code>
<a class=anchor href=#tomlgett>#</a></h1><h2 id=overview>Overview
<a class=anchor href=#overview>#</a></h2><p>Generally, <code>toml::get</code> behaves as follows:
You specify <code>T</code> as in <code>toml::get&lt;int>(v)</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>However, depending on the type of <code>T</code>, <code>toml::get</code> can exhibit different behaviors.</p><p>The types of <code>T</code> can be categorized into:</p><ol><li>Types that do not require conversion</li><li>Types that require conversion</li></ol><p>Detailed conditions and the specific types supported are discussed later.</p><h3 id=types-that-do-not-require-conversion>Types that Do Not Require Conversion
<a class=anchor href=#types-that-do-not-require-conversion>#</a></h3><p>No conversion is needed if the provided <code>toml::value</code> is already storing the desired type. For instance, since <code>toml::value::integer_type</code> is an alias for <code>std::int64_t</code>, <code>toml::get&lt;std::int64_t>(v)</code> requires no conversion. In this case, <code>toml::get</code> retrieves the <code>integer</code> value from <code>toml::value</code> and returns a reference to it.</p><p>If the provided <code>toml::value</code> is a mutable reference (<code>&</code>), the returned value is also a mutable reference (<code>&</code>). If it is an immutable reference (<code>const&</code>), the returned value will also be an immutable reference (<code>const&</code>). Returning a mutable reference allows you to overwrite the value stored in <code>toml::value</code> through that reference.</p><h3 id=types-that-require-conversion>Types that Require Conversion
<a class=anchor href=#types-that-require-conversion>#</a></h3><p>Types other than the ones mentioned above require conversion. For example, since <code>toml::value::integer_type</code> is an alias for <code>std::int64_t</code>, <code>toml::get&lt;std::size_t>(toml::value&)</code> requires conversion. In this case, <code>toml::get</code> retrieves the <code>integer</code> value from <code>toml::value</code> and casts it to return the appropriate type.</p><p>toml11 supports not only simple casts but also complex type conversions like converting from <code>toml::array</code> to <code>std::tuple&lt;int, double, std::string></code>, <code>std::array&lt;double, 4></code>, or from <code>toml::table</code> to <code>std::map&lt;std::string, int></code>. For specifics, refer to the subsequent sections.</p><h3 id=when-conversion-fails>When Conversion Fails
<a class=anchor href=#when-conversion-fails>#</a></h3><p>Sometimes, the expected type conversion cannot be performed. For example, applying <code>toml::get&lt;int>(v)</code> to a <code>toml::value</code> that holds a <code>table</code>.</p><p>In such cases, an attempt to convert to the type most similar to the desired type (in this case, <code>int</code> using <code>as_integer</code>) fails, and a <code>toml::type_error</code> is thrown.</p><p>When parsing from a file, an error message similar to the following is output:</p><pre tabindex=0><code>terminate called after throwing an instance of &#39;toml::type_error&#39;
what(): toml::value::as_integer(): bad_cast to integer
--&gt; input.toml
|
6 | [fruit]
| ^^^^^^^-- the actual type is table
</code></pre><h2 id=when-t-is-identical-to-tomlvalue>When <code>T</code> is identical to <code>toml::value</code>
<a class=anchor href=#when-t-is-identical-to-tomlvalue>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T<span style=color:#f92672>&amp;</span> get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>std::is_same&lt;T, basic_value&lt;TC>></code> is satisfied.</li></ul><p>Since this involves retrieving <code>toml::value</code> from <code>toml::value</code>, no conversion is performed, and the value is returned as is. This exists solely to generalize the implementation of other functions.</p><p>This does not fail.</p><h2 id=when-t-is-one-of-tomlvaluesome_type>When <code>T</code> is one of <code>toml::value::{some_type}</code>
<a class=anchor href=#when-t-is-one-of-tomlvaluesome_type>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T<span style=color:#f92672>&amp;</span> get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>T</code> must be the same as one of the types that <code>toml::value</code> can store (e.g., <code>toml::value::boolean_type</code>).</li></ul><p>If <code>toml::value</code> is storing a type that matches the specified type in <code>toml::get&lt;T></code>, such as <code>toml::value::integer_type</code>, no type conversion is needed, and a reference can be returned.</p><p>If a different type is stored, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-basic_valueothertc-with-a-different-typeconfig>When <code>T</code> is <code>basic_value&lt;OtherTC></code> with a different <code>TypeConfig</code>
<a class=anchor href=#when-t-is-basic_valueothertc-with-a-different-typeconfig>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>T</code> is not <code>toml::basic_value&lt;TC></code>.</li><li><code>T</code> is <code>toml::basic_value&lt;OtherTC></code>.</li></ul><p>When a <code>basic_value</code> that can store different types is specified, conversion is performed.</p><p>Since type conversion occurs, the returned value is a new value and not a reference.</p><p>This does not fail (except in cases like memory exhaustion).</p><h2 id=when-t-is-an-integer-type>When <code>T</code> is an integer type
<a class=anchor href=#when-t-is-an-integer-type>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>std::is_integral&lt;T></code> is satisfied</li><li><code>T</code> is not <code>bool</code></li><li><code>T</code> is not <code>toml::value::integer_type</code></li></ul><p>The function assumes that <code>toml::value</code> holds an <code>integer_type</code>, retrieves its value, converts it to <code>T</code>, and returns it.</p><p>If a type other than <code>toml::value::integer_type</code> is stored, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-a-floating-point-type>When <code>T</code> is a floating-point type
<a class=anchor href=#when-t-is-a-floating-point-type>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>std::is_floating_point&lt;T></code> is satisfied</li><li><code>T</code> is not <code>toml::value::floating_type</code></li></ul><p>The function assumes that <code>toml::value</code> holds a <code>floating_type</code>, retrieves its value, converts it to <code>T</code>, and returns it.</p><p>If a type other than <code>toml::value::floating_type</code> is stored, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-stdstring_view>When <code>T</code> is <code>std::string_view</code>
<a class=anchor href=#when-t-is-stdstring_view>#</a></h2><p>This is only available in C++17 and later.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>std::is_same&lt;std::string_view, T></code> is satisfied</li></ul><p>The function assumes that <code>toml::value</code> holds a <code>string_type</code>, retrieves its value, constructs a <code>std::string_view</code> from it, and returns it.</p><p>If a type other than <code>toml::value::string_type</code> is stored, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-stdchronoduration>When <code>T</code> is <code>std::chrono::duration</code>
<a class=anchor href=#when-t-is-stdchronoduration>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>T</code> is <code>std::chrono::duration&lt;Rep, Period></code></li></ul><p>The function assumes that <code>toml::value</code> holds a <code>local_time</code>, retrieves its value, converts it to <code>std::chrono::duration</code>, and returns it.</p><p>If a type other than <code>toml::value::local_time</code> is stored, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-stdchronosystem_clocktime_point>When <code>T</code> is <code>std::chrono::system_clock::time_point</code>
<a class=anchor href=#when-t-is-stdchronosystem_clocktime_point>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>std::is_same&lt;T, std::chrono::system_clock::time_point></code> is satisfied</li></ul><p>If the <code>toml::value</code> holds a <code>local_date</code>, <code>local_datetime</code>, or <code>offset_datetime</code>, this function retrieves the value and converts it to <code>std::chrono::system_clock::time_point</code>, returning the result.</p><p>If the value is of a type other than <code>local_date</code>, <code>local_datetime</code>, or <code>offset_datetime</code>, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-array-like>When <code>T</code> is array-like
<a class=anchor href=#when-t-is-array-like>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Conditions:</p><ul><li><code>T</code> has an <code>iterator</code></li><li><code>T</code> has a <code>value_type</code></li><li><code>T</code> supports <code>push_back(x)</code></li><li><code>T</code> is not <code>toml::value::array_type</code></li><li><code>T</code> is not <code>std::string</code></li><li><code>T</code> is not <code>std::string_view</code></li><li><code>T</code> is not map-like</li><li><code>T</code> does not have <code>from_toml()</code> member function</li><li><code>toml::from&lt;T></code> is not defined</li><li>A constructor from <code>toml::basic_value&lt;TC></code> is not defined</li></ul><p>This includes types like <code>std::vector&lt;int></code> and <code>std::deque&lt;std::string></code>.</p><p>If the <code>toml::value</code> holds an <code>array</code>, this function retrieves the value and converts it to the specified container type, returning the result.</p><p>If the value is of a type other than <code>toml::value::array_type</code>, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-stdarray>When <code>T</code> is <code>std::array</code>
<a class=anchor href=#when-t-is-stdarray>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition</p><ul><li><code>T</code> is <code>std::array&lt;U, N></code></li></ul><p>If the <code>toml::value</code> holds an <code>array</code>, this function retrieves the value and converts it to the specified container type, returning the result.</p><p>If the value is of a type other than <code>toml::value::array_type</code>, a <code>toml::type_error</code> is thrown.</p><p>If the <code>array</code> held by <code>toml::value</code> does not contain enough elements, a <code>std::out_of_range</code> is thrown.</p><h2 id=when-t-is-stdforward_list>When <code>T</code> is <code>std::forward_list</code>
<a class=anchor href=#when-t-is-stdforward_list>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>T</code> is <code>std::forward_list&lt;U></code></li></ul><p>If the <code>toml::value</code> holds an <code>array</code>, this function retrieves the value and converts it to a <code>std::forward_list</code>, returning the result.</p><p>If the value is of a type other than <code>toml::value::array_type</code>, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-stdpair>When <code>T</code> is <code>std::pair</code>
<a class=anchor href=#when-t-is-stdpair>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>T</code> is <code>std::pair&lt;T1, T2></code></li></ul><p>If the <code>toml::value</code> holds an <code>array</code>, this function retrieves the value and converts it to <code>std::pair&lt;T1, T2></code>, returning the result.</p><p>The <code>first</code> and <code>second</code> elements are recursively converted.</p><p>If the value is of a type other than <code>basic_value::array_type</code>, a <code>toml::type_error</code> is thrown.</p><p>If the <code>array</code> held by <code>toml::value</code> does not contain exactly 2 elements, a <code>std::out_of_range</code> is thrown.</p><h2 id=when-t-is-stdtuple>When <code>T</code> is <code>std::tuple</code>
<a class=anchor href=#when-t-is-stdtuple>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li><code>T</code> is <code>std::tuple&lt;T1, T2, ... TN></code></li></ul><p>If the <code>toml::value</code> holds an <code>array</code>, this function retrieves the value and converts it to <code>std::tuple&lt;T1, T2, ...TN></code>, returning the result.</p><p>Each element is recursively converted.</p><p>If the value is of a type other than <code>basic_value::array_type</code>, a <code>toml::type_error</code> is thrown.</p><p>If the <code>array</code> held by <code>toml::value</code> does not contain exactly <code>std::tuple_size&lt;T>::value</code> elements, a <code>std::out_of_range</code> is thrown.</p><h2 id=when-t-is-map-like>When <code>T</code> is map-like
<a class=anchor href=#when-t-is-map-like>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Conditions:</p><ul><li><code>T</code> has an <code>iterator</code></li><li><code>T</code> has a <code>key_type</code></li><li><code>T</code> has a <code>value_type</code></li><li><code>T</code> has a <code>mapped_type</code></li><li><code>T</code> is not <code>toml::value::table_type</code></li><li><code>T</code> does not have a <code>from_toml()</code> member function</li><li><code>toml::from&lt;T></code> is not defined</li><li>A constructor from <code>toml::basic_value&lt;TC></code> is not defined</li></ul><p>This includes types like <code>std::map&lt;std::string, int></code> and <code>std::unordered_map&lt;std::string, float></code>.</p><p>If the <code>toml::value</code> holds a <code>table</code>, this function retrieves the value and converts it to <code>T</code>, returning the result.</p><p>Elements are recursively converted.</p><p>If the value is of a type other than <code>basic_value::table_type</code>, a <code>toml::type_error</code> is thrown.</p><h2 id=when-t-is-a-user-defined-type-with-a-specialization-of-tomlfromt>When <code>T</code> is a user-defined type with a specialization of <code>toml::from&lt;T></code>
<a class=anchor href=#when-t-is-a-user-defined-type-with-a-specialization-of-tomlfromt>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Condition:</p><ul><li>A specialization of <code>toml::from&lt;T></code> is defined</li></ul><p>If a specialization of <code>toml::from</code> for <code>T</code> is defined, it is used for type conversion.</p><p>Ensure this does not conflict with individually supported types (<code>std::array</code>, <code>std::pair</code>, <code>std::tuple</code> etc).</p><h2 id=when-t-is-a-user-defined-type-with-a-from_toml-member-function>When <code>T</code> is a user-defined type with a <code>from_toml</code> member function
<a class=anchor href=#when-t-is-a-user-defined-type-with-a-from_toml-member-function>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Conditions:</p><ul><li><code>toml::from&lt;T></code> is not defined</li><li><code>T</code> has <code>from_toml()</code> member function</li></ul><p>If <code>T</code> has a <code>from_toml(toml::basic_value&lt;TC>)</code> member function, it is used for type conversion.</p><p>If <code>toml::from&lt;T></code> is defined, it takes precedence.</p><h2 id=when-t-is-a-user-defined-type-with-a-constructor-that-takes-tomlbasic_valuetc>When <code>T</code> is a user-defined type with a constructor that takes <code>toml::basic_value&lt;TC></code>
<a class=anchor href=#when-t-is-a-user-defined-type-with-a-constructor-that-takes-tomlbasic_valuetc>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v);
</span></span></code></pre></div><p>Conditions:</p><ul><li><code>toml::from&lt;T></code> is not defined</li><li><code>T</code> does not have <code>from_toml()</code> member function</li><li><code>T</code> has a constructor that takes <code>toml::basic_value&lt;TC></code></li></ul><p>If <code>T</code> has a constructor that takes <code>toml::basic_value&lt;TC></code>, it is used for type conversion.</p><p>If <code>toml::from&lt;T></code> or <code>T::from_toml</code> is defined, they take precedence.</p><h1 id=tomlget_ort><code>toml::get_or&lt;T></code>
<a class=anchor href=#tomlget_ort>#</a></h1><p><code>get_or</code> takes a default value for use when the conversion fails, avoiding exceptions.</p><p>The default value must be of the same type as the target type <code>T</code>.
Therefore, unlike <code>toml::get&lt;T></code>, <code>T</code> can be inferred in <code>get_or</code>.</p><h2 id=when-t-is-basic_valuetc>When <code>T</code> is <code>basic_value&lt;TC></code>
<a class=anchor href=#when-t-is-basic_valuetc>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> opt)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> <span style=color:#f92672>&amp;</span> get_or(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> opt)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> get_or(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v, basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> opt)
</span></span></code></pre></div><p>Since the conversion target is the same <code>toml::value</code>, this never fails.</p><p>It exists solely to generalize the implementation of other functions.</p><h2 id=when-t-is-basic_valuetcsome_type>When <code>T</code> is <code>basic_value&lt;TC>::{some_type}</code>
<a class=anchor href=#when-t-is-basic_valuetcsome_type>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, <span style=color:#66d9ef>const</span> T<span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T <span style=color:#f92672>&amp;</span> get_or(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, T<span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>T get_or(basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;&amp;</span> v, T<span style=color:#f92672>&amp;&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>
</span></span></code></pre></div><p>Performs the same conversion as <code>toml::get&lt;T></code>. If it fails, the second argument is returned.</p><h2 id=when-t-is-const-char>When <code>T</code> is <code>const char*</code>
<a class=anchor href=#when-t-is-const-char>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>string_type
</span></span><span style=display:flex><span>get_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>string_type<span style=color:#f92672>::</span>value_type<span style=color:#f92672>*</span> opt);
</span></span></code></pre></div><p>When <code>const char*</code> is passed, the conversion target is interpreted as <code>std::string</code>.</p><h2 id=when-t-is-something-else>When <code>T</code> is something else
<a class=anchor href=#when-t-is-something-else>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>typename</span> std<span style=color:#f92672>::</span>remove_cv<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> std<span style=color:#f92672>::</span>remove_reference<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;::</span>type<span style=color:#f92672>&gt;::</span>type
</span></span><span style=display:flex><span>get_or(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, T<span style=color:#f92672>&amp;&amp;</span> opt);
</span></span></code></pre></div><p>Performs the same conversion as <code>toml::get&lt;T></code>. If it fails, the second argument is returned.</p><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/find/>find.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/from/>from.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/value/>value.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#gethpp>get.hpp</a></li><li><a href=#tomlgett><code>toml::get&lt;T></code></a><ul><li><a href=#overview>Overview</a><ul><li><a href=#types-that-do-not-require-conversion>Types that Do Not Require Conversion</a></li><li><a href=#types-that-require-conversion>Types that Require Conversion</a></li><li><a href=#when-conversion-fails>When Conversion Fails</a></li></ul></li><li><a href=#when-t-is-identical-to-tomlvalue>When <code>T</code> is identical to <code>toml::value</code></a></li><li><a href=#when-t-is-one-of-tomlvaluesome_type>When <code>T</code> is one of <code>toml::value::{some_type}</code></a></li><li><a href=#when-t-is-basic_valueothertc-with-a-different-typeconfig>When <code>T</code> is <code>basic_value&lt;OtherTC></code> with a different <code>TypeConfig</code></a></li><li><a href=#when-t-is-an-integer-type>When <code>T</code> is an integer type</a></li><li><a href=#when-t-is-a-floating-point-type>When <code>T</code> is a floating-point type</a></li><li><a href=#when-t-is-stdstring_view>When <code>T</code> is <code>std::string_view</code></a></li><li><a href=#when-t-is-stdchronoduration>When <code>T</code> is <code>std::chrono::duration</code></a></li><li><a href=#when-t-is-stdchronosystem_clocktime_point>When <code>T</code> is <code>std::chrono::system_clock::time_point</code></a></li><li><a href=#when-t-is-array-like>When <code>T</code> is array-like</a></li><li><a href=#when-t-is-stdarray>When <code>T</code> is <code>std::array</code></a></li><li><a href=#when-t-is-stdforward_list>When <code>T</code> is <code>std::forward_list</code></a></li><li><a href=#when-t-is-stdpair>When <code>T</code> is <code>std::pair</code></a></li><li><a href=#when-t-is-stdtuple>When <code>T</code> is <code>std::tuple</code></a></li><li><a href=#when-t-is-map-like>When <code>T</code> is map-like</a></li><li><a href=#when-t-is-a-user-defined-type-with-a-specialization-of-tomlfromt>When <code>T</code> is a user-defined type with a specialization of <code>toml::from&lt;T></code></a></li><li><a href=#when-t-is-a-user-defined-type-with-a-from_toml-member-function>When <code>T</code> is a user-defined type with a <code>from_toml</code> member function</a></li><li><a href=#when-t-is-a-user-defined-type-with-a-constructor-that-takes-tomlbasic_valuetc>When <code>T</code> is a user-defined type with a constructor that takes <code>toml::basic_value&lt;TC></code></a></li></ul></li><li><a href=#tomlget_ort><code>toml::get_or&lt;T></code></a><ul><li><a href=#when-t-is-basic_valuetc>When <code>T</code> is <code>basic_value&lt;TC></code></a></li><li><a href=#when-t-is-basic_valuetcsome_type>When <code>T</code> is <code>basic_value&lt;TC>::{some_type}</code></a></li><li><a href=#when-t-is-const-char>When <code>T</code> is <code>const char*</code></a></li><li><a href=#when-t-is-something-else>When <code>T</code> is something else</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

64
docs/reference/index.html Normal file
View File

@@ -0,0 +1,64 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
Reference
#
Here, we explain the effects of the classes and functions provided by toml11.
Directory Structure
#
toml.hpp and toml_fwd.hpp reside in ${TOML11_INCLUDE_DIR}.
Other files are located in ${TOML11_INCLUDE_DIR}/toml11.
If you want to #include each feature&rsquo;s file individually, use #include <toml11/color.hpp>.
If you want to include all at once, use #include <toml.hpp>.
color.hpp
#
Defines functions related to colorizing error messages.
comments.hpp
#
Defines types preserve_comment and discard_comment for preserving comments."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="reference"><meta property="og:description" content="Reference # Here, we explain the effects of the classes and functions provided by toml11.
Directory Structure # toml.hpp and toml_fwd.hpp reside in ${TOML11_INCLUDE_DIR}. Other files are located in ${TOML11_INCLUDE_DIR}/toml11.
If you want to #include each features file individually, use #include <toml11/color.hpp>. If you want to include all at once, use #include <toml.hpp>.
color.hpp # Defines functions related to colorizing error messages.
comments.hpp # Defines types preserve_comment and discard_comment for preserving comments."><meta property="og:locale" content="en"><meta property="og:type" content="website"><title>reference | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/ title=reference><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script><link rel=alternate type=application/rss+xml href=https://toruniina.github.io/toml11/docs/reference/index.xml title=toml11></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/ class=active>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>reference</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#reference>Reference</a><ul><li><a href=#directory-structure>Directory Structure</a></li><li><a href=#colorhpp>color.hpp</a></li><li><a href=#commentshpp>comments.hpp</a></li><li><a href=#conversionhpp>conversion.hpp</a></li><li><a href=#datetimehpp>datetime.hpp</a></li><li><a href=#error_>error_info.hpp</a></li><li><a href=#exceptionhpp>exception.hpp</a></li><li><a href=#findhpp>find.hpp</a></li><li><a href=#formathpp>format.hpp</a></li><li><a href=#fromhpp>from.hpp</a></li><li><a href=#gethpp>get.hpp</a></li><li><a href=#intohpp>into.hpp</a></li><li><a href=#literalhpp>literal.hpp</a></li><li><a href=#ordered_>ordered_map.hpp</a></li><li><a href=#parserhpp>parser.hpp</a></li><li><a href=#resulthpp>result.hpp</a></li><li><a href=#serializerhpp>serializer.hpp</a></li><li><a href=#source_>source_location.hpp</a></li><li><a href=#spechpp>spec.hpp</a></li><li><a href=#tomlhpp>toml.hpp</a></li><li><a href=#toml_>toml_fwd.hpp</a></li><li><a href=#typeshpp>types.hpp</a></li><li><a href=#valuehpp>value.hpp</a></li><li><a href=#value_>value_t.hpp</a></li><li><a href=#versionhpp>version.hpp</a></li><li><a href=#visithpp>visit.hpp</a></li><li><a href=#notes>Notes</a></li></ul></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=reference>Reference
<a class=anchor href=#reference>#</a></h1><p>Here, we explain the effects of the classes and functions provided by toml11.</p><h2 id=directory-structure>Directory Structure
<a class=anchor href=#directory-structure>#</a></h2><p><code>toml.hpp</code> and <code>toml_fwd.hpp</code> reside in <code>${TOML11_INCLUDE_DIR}</code>.
Other files are located in <code>${TOML11_INCLUDE_DIR}/toml11</code>.</p><p>If you want to <code>#include</code> each feature&rsquo;s file individually, use <code>#include &lt;toml11/color.hpp></code>.
If you want to include all at once, use <code>#include &lt;toml.hpp></code>.</p><h2 id=colorhpp><a href=color>color.hpp</a>
<a class=anchor href=#colorhpp>#</a></h2><p>Defines functions related to colorizing error messages.</p><h2 id=commentshpp><a href=comments>comments.hpp</a>
<a class=anchor href=#commentshpp>#</a></h2><p>Defines types <code>preserve_comment</code> and <code>discard_comment</code> for preserving comments.</p><h2 id=conversionhpp><a href=conversion>conversion.hpp</a>
<a class=anchor href=#conversionhpp>#</a></h2><p>Defines macros to automatically convert <code>toml::value</code> and user-defined classes.</p><h2 id=datetimehpp><a href=datetime>datetime.hpp</a>
<a class=anchor href=#datetimehpp>#</a></h2><p>Defines classes for datetime information.</p><h2 id=error_><a href=error_info>error_info.hpp</a>
<a class=anchor href=#error_>#</a></h2><p>Defines a class for error information.</p><h2 id=exceptionhpp><a href=exception>exception.hpp</a>
<a class=anchor href=#exceptionhpp>#</a></h2><p>Defines the base class for exceptions used in toml11, <code>toml::exception</code>.</p><h2 id=findhpp><a href=find>find.hpp</a>
<a class=anchor href=#findhpp>#</a></h2><p>Defines the <code>toml::find</code> function to search for and convert values.</p><h2 id=formathpp><a href=format>format.hpp</a>
<a class=anchor href=#formathpp>#</a></h2><p>Defines classes for formatting information of values.</p><h2 id=fromhpp><a href=from>from.hpp</a>
<a class=anchor href=#fromhpp>#</a></h2><p>Forward declaration of the <code>from&lt;T></code> type for converting user-defined types.</p><h2 id=gethpp><a href=get>get.hpp</a>
<a class=anchor href=#gethpp>#</a></h2><p>Defines the <code>toml::get&lt;T></code> function to retrieve and convert values from <code>toml::value</code>.</p><h2 id=intohpp><a href=into>into.hpp</a>
<a class=anchor href=#intohpp>#</a></h2><p>Forward declaration of the <code>into&lt;T></code> type for converting user-defined types.</p><h2 id=literalhpp><a href=literal>literal.hpp</a>
<a class=anchor href=#literalhpp>#</a></h2><p>Defines the <code>operator"" _toml</code> literal.</p><h2 id=ordered_><a href=ordered_map>ordered_map.hpp</a>
<a class=anchor href=#ordered_>#</a></h2><p>Defines <code>toml::ordered_map</code>.</p><h2 id=parserhpp><a href=parser>parser.hpp</a>
<a class=anchor href=#parserhpp>#</a></h2><p>Defines functions to parse files or strings.</p><h2 id=resulthpp><a href=result>result.hpp</a>
<a class=anchor href=#resulthpp>#</a></h2><p>Defines the <code>result&lt;T, E></code> type for representing success or failure values used as return types in other functions.</p><h2 id=serializerhpp><a href=serializer>serializer.hpp</a>
<a class=anchor href=#serializerhpp>#</a></h2><p>Defines the <code>toml::format</code> function and <code>toml::serializer</code> used for serialization.</p><h2 id=source_><a href=source_location>source_location.hpp</a>
<a class=anchor href=#source_>#</a></h2><p>Defines the <code>source_location</code> type used for error information, pointing to a location within a file.</p><h2 id=spechpp><a href=spec>spec.hpp</a>
<a class=anchor href=#spechpp>#</a></h2><p>Defines the <code>toml::semantic_version</code> and <code>toml::spec</code> types to control TOML language version information and feature flags.</p><h2 id=tomlhpp><a href=toml>toml.hpp</a>
<a class=anchor href=#tomlhpp>#</a></h2><p><code>toml.hpp</code> includes all other headers, making all toml11 features available.</p><h2 id=toml_><a href=toml_fwd>toml_fwd.hpp</a>
<a class=anchor href=#toml_>#</a></h2><p><code>toml_fwd.hpp</code> contains forward declarations of structs defined in toml11 and macro definitions.</p><h2 id=typeshpp><a href=types>types.hpp</a>
<a class=anchor href=#typeshpp>#</a></h2><p>Defines the <code>toml::type_config</code> type for controlling the types held by <code>toml::value</code>.</p><h2 id=valuehpp><a href=value>value.hpp</a>
<a class=anchor href=#valuehpp>#</a></h2><p>Defines the <code>toml::value</code> type.</p><h2 id=value_><a href=value_t>value_t.hpp</a>
<a class=anchor href=#value_>#</a></h2><p>Defines the <code>toml::value_t</code> enumeration.</p><h2 id=versionhpp><a href=version>version.hpp</a>
<a class=anchor href=#versionhpp>#</a></h2><p>Defines the version information for toml11.</p><h2 id=visithpp><a href=visit>visit.hpp</a>
<a class=anchor href=#visithpp>#</a></h2><p>Defines the <code>toml::visit</code> function to apply functions to the values held by <code>toml::value</code>.</p><h2 id=notes>Notes
<a class=anchor href=#notes>#</a></h2><p>Functions not explicitly mentioned here (mostly those defined under <code>namespace toml::detail</code> or <code>namespace toml::cxx</code>) are available by inspecting the source code but are not guaranteed to maintain their interface across future versions (including patch version updates).</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#reference>Reference</a><ul><li><a href=#directory-structure>Directory Structure</a></li><li><a href=#colorhpp>color.hpp</a></li><li><a href=#commentshpp>comments.hpp</a></li><li><a href=#conversionhpp>conversion.hpp</a></li><li><a href=#datetimehpp>datetime.hpp</a></li><li><a href=#error_>error_info.hpp</a></li><li><a href=#exceptionhpp>exception.hpp</a></li><li><a href=#findhpp>find.hpp</a></li><li><a href=#formathpp>format.hpp</a></li><li><a href=#fromhpp>from.hpp</a></li><li><a href=#gethpp>get.hpp</a></li><li><a href=#intohpp>into.hpp</a></li><li><a href=#literalhpp>literal.hpp</a></li><li><a href=#ordered_>ordered_map.hpp</a></li><li><a href=#parserhpp>parser.hpp</a></li><li><a href=#resulthpp>result.hpp</a></li><li><a href=#serializerhpp>serializer.hpp</a></li><li><a href=#source_>source_location.hpp</a></li><li><a href=#spechpp>spec.hpp</a></li><li><a href=#tomlhpp>toml.hpp</a></li><li><a href=#toml_>toml_fwd.hpp</a></li><li><a href=#typeshpp>types.hpp</a></li><li><a href=#valuehpp>value.hpp</a></li><li><a href=#value_>value_t.hpp</a></li><li><a href=#versionhpp>version.hpp</a></li><li><a href=#visithpp>visit.hpp</a></li><li><a href=#notes>Notes</a></li></ul></li></ul></nav></div></aside></main></body></html>

768
docs/reference/index.xml Normal file
View File

@@ -0,0 +1,768 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>reference on toml11</title><link>https://toruniina.github.io/toml11/docs/reference/</link><description>Recent content in reference on toml11</description><generator>Hugo</generator><language>en</language><atom:link href="https://toruniina.github.io/toml11/docs/reference/index.xml" rel="self" type="application/rss+xml"/><item><title>color.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/color/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/color/</guid><description>&lt;h1 id="colorhpp"&gt;
color.hpp
&lt;a class="anchor" href="#colorhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;In &lt;code&gt;color.hpp&lt;/code&gt;, functions related to colorizing error messages are defined.&lt;/p&gt;
&lt;p&gt;Colors are specified using ANSI escape code.
In terminals or other output destinations that do not support ANSI escape code, the output may become difficult to read.&lt;/p&gt;
&lt;h2 id="macros"&gt;
Macros
&lt;a class="anchor" href="#macros"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="toml11_colorize_error_message"&gt;
&lt;code&gt;TOML11_COLORIZE_ERROR_MESSAGE&lt;/code&gt;
&lt;a class="anchor" href="#toml11_colorize_error_message"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;If this macro is defined during compilation (&lt;code&gt;-DTOML11_COLORIZE_ERROR_MESASGE&lt;/code&gt;), error messages are colored by default.&lt;/p&gt;
&lt;p&gt;If not defined, colors are not applied by default. You need to specify them using &lt;code&gt;toml::color::enable()&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>comments.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/comments/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/comments/</guid><description>&lt;h1 id="commentshpp"&gt;
comments.hpp
&lt;a class="anchor" href="#commentshpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;In &lt;code&gt;comments.hpp&lt;/code&gt;, comment containers are provided.&lt;/p&gt;
&lt;h1 id="tomlpreserve_comments"&gt;
&lt;code&gt;toml::preserve_comments&lt;/code&gt;
&lt;a class="anchor" href="#tomlpreserve_comments"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;preserve_comments&lt;/code&gt; is a container that preserves comments.&lt;/p&gt;
&lt;p&gt;It has all the member functions of &lt;code&gt;std::vector&amp;lt;std::string&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Comments are preserved as &lt;code&gt;std::string&lt;/code&gt;.
If the comment does not start with &lt;code&gt;#&lt;/code&gt;, it will be prefixed with &lt;code&gt;#&lt;/code&gt; during output.
However, this prefixing is not done when adding comments to the container.&lt;/p&gt;
&lt;p&gt;Spaces are not automatically added, so if you want a space immediately after &lt;code&gt;#&lt;/code&gt;,
either start the comment with a space or pass the comment with &lt;code&gt;#&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>conversion.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/conversion/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/conversion/</guid><description>&lt;h1 id="conversionhpp"&gt;
conversion.hpp
&lt;a class="anchor" href="#conversionhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Provides macros to automatically define conversion functions for supporting user-defined types with &lt;code&gt;toml::get&lt;/code&gt; and &lt;code&gt;toml::find&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(NAME, ...)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="example"&gt;
Example
&lt;a class="anchor" href="#example"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; foo
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Foo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string s;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;double&lt;/span&gt; d;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// foo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(foo&lt;span style="color:#f92672"&gt;::&lt;/span&gt;Foo, s, d, i)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="related"&gt;
Related
&lt;a class="anchor" href="#related"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://toruniina.github.io/toml11/docs/reference/from/"&gt;from.hpp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://toruniina.github.io/toml11/docs/reference/into/"&gt;into.hpp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>datetime.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/datetime/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/datetime/</guid><description>&lt;h1 id="datetimehpp"&gt;
datetime.hpp
&lt;a class="anchor" href="#datetimehpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Defines a class that stores date and time information used in TOML&amp;rsquo;s &lt;code&gt;datetime&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id="enum-class-month_t"&gt;
&lt;code&gt;enum class month_t&lt;/code&gt;
&lt;a class="anchor" href="#enum-class-month_t"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Enum class to specify months.&lt;/p&gt;
&lt;p&gt;Due to its relationship with &lt;code&gt;std::tm&lt;/code&gt;, &lt;code&gt;local_date&lt;/code&gt; treats January as &lt;code&gt;0&lt;/code&gt;.
To avoid confusion, &lt;code&gt;month_t&lt;/code&gt; allows specification of months by their names.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;enum&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;month_t&lt;/span&gt; &lt;span style="color:#f92672"&gt;:&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint8_t&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Jan &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Feb &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Mar &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Apr &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; May &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Jun &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Jul &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;6&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Aug &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;7&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Sep &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Oct &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Nov &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Dec &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;11&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="local_date"&gt;
&lt;code&gt;local_date&lt;/code&gt;
&lt;a class="anchor" href="#local_date"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;local_date&lt;/code&gt; holds a date.&lt;/p&gt;</description></item><item><title>error_info.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/error_info/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/error_info/</guid><description>&lt;h1 id="error_infohpp"&gt;
error_info.hpp
&lt;a class="anchor" href="#error_infohpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;In &lt;code&gt;error_info.hpp&lt;/code&gt;, definitions for &lt;code&gt;error_info&lt;/code&gt; and functions to format it are provided.&lt;/p&gt;
&lt;h1 id="tomlerror_info"&gt;
&lt;code&gt;toml::error_info&lt;/code&gt;
&lt;a class="anchor" href="#tomlerror_info"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;error_info&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; error_info(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string t, source_location l, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string m, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string s &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; error_info(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string t, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;vector&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;pair&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;source_location, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;gt;&amp;gt;&lt;/span&gt; l, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string s &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; title() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; title() &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;vector&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;pair&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;source_location, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; locations() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;void&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;add_locations&lt;/span&gt;(source_location loc, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string msg) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; suffix() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; suffix() &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; ... Ts&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;error_info make_error_info(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string title, source_location loc, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string msg, Ts&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ... tail);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string format_error(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; errkind, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; error_info&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; err);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string format_error(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; error_info&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; err);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; ... Ts&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string format_error(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string title,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; source_location loc, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string msg, Ts&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ... tail);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; os, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; error_info&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; e);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="member-functions"&gt;
Member Functions
&lt;a class="anchor" href="#member-functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="constructor-title-loc-msg-suffix"&gt;
Constructor (&lt;code&gt;title, loc, msg, suffix&lt;/code&gt;)
&lt;a class="anchor" href="#constructor-title-loc-msg-suffix"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Constructs &lt;code&gt;error_info&lt;/code&gt; with specified &lt;code&gt;title&lt;/code&gt;, location information &lt;code&gt;loc&lt;/code&gt;, message &lt;code&gt;msg&lt;/code&gt;, and optional &lt;code&gt;suffix&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>exception.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/exception/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/exception/</guid><description>&lt;h1 id="exceptionhpp"&gt;
exception.hpp
&lt;a class="anchor" href="#exceptionhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h1 id="tomlexception"&gt;
&lt;code&gt;toml::exception&lt;/code&gt;
&lt;a class="anchor" href="#tomlexception"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Base class for exception types defined in toml11.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;exception&lt;/span&gt; &lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;exception
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;virtual&lt;/span&gt; &lt;span style="color:#f92672"&gt;~&lt;/span&gt;exception() &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;override&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;virtual&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt;&lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;what&lt;/span&gt;() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;override&lt;/span&gt; {&lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="member-functions"&gt;
Member Functions
&lt;a class="anchor" href="#member-functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="destructor"&gt;
Destructor
&lt;a class="anchor" href="#destructor"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;virtual&lt;/span&gt; &lt;span style="color:#f92672"&gt;~&lt;/span&gt;exception() &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;override&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Override when derived.&lt;/p&gt;
&lt;h3 id="what"&gt;
&lt;code&gt;what&lt;/code&gt;
&lt;a class="anchor" href="#what"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;virtual&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt;&lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;what&lt;/span&gt;() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;override&lt;/span&gt; {&lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Returns the error message. Override when derived.&lt;/p&gt;</description></item><item><title>find.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/find/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/find/</guid><description>&lt;h1 id="findhpp"&gt;
find.hpp
&lt;a class="anchor" href="#findhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;This function searches for a value in a &lt;code&gt;toml::value&lt;/code&gt; and performs type conversion if necessary.&lt;/p&gt;
&lt;blockquote class="book-hint info"&gt;
&lt;code&gt;toml::value&lt;/code&gt; can change the type it stores, and &lt;code&gt;toml::find&lt;/code&gt; accommodates these types.
Technically, all functions use &lt;code&gt;toml::basic_value&amp;lt;TC&amp;gt;&lt;/code&gt;.
However, for simplicity, we refer to it as &lt;code&gt;toml::value&lt;/code&gt; in explanations unless a distinction is necessary.
In the documentation, if the template parameter &lt;code&gt;TC&lt;/code&gt; changes the type, assume that types like &lt;code&gt;toml::value::integer_type&lt;/code&gt; will also change accordingly.
&lt;/blockquote&gt;
&lt;h1 id="tomlfind"&gt;
&lt;code&gt;toml::find&lt;/code&gt;
&lt;a class="anchor" href="#tomlfind"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h2 id="overview"&gt;
Overview
&lt;a class="anchor" href="#overview"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;toml::find&lt;/code&gt; uses template arguments for the type you want to retrieve and function arguments for the key of the value you want to find.&lt;/p&gt;</description></item><item><title>format.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/format/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/format/</guid><description>&lt;h1 id="formathpp"&gt;
format.hpp
&lt;a class="anchor" href="#formathpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Defines structures and enumerations related to formatting information for &lt;code&gt;toml::value&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id="indent_char"&gt;
&lt;code&gt;indent_char&lt;/code&gt;
&lt;a class="anchor" href="#indent_char"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;An enumeration representing the indentation character choice.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;enum&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;indent_char&lt;/span&gt; &lt;span style="color:#f92672"&gt;:&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint8_t&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; space, &lt;span style="color:#75715e"&gt;// use space
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; tab, &lt;span style="color:#75715e"&gt;// use tab
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; none &lt;span style="color:#75715e"&gt;// no indent
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; os, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; indent_char&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; c);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string to_string(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; indent_char);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Choosing &lt;code&gt;none&lt;/code&gt; means no indentation is used, regardless of the value in super tables.&lt;/p&gt;
&lt;p&gt;If both &lt;code&gt;space&lt;/code&gt; and &lt;code&gt;tab&lt;/code&gt; are specified within the serializable value, the behavior is unspecified; typically, the unspecified indentation character appears.&lt;/p&gt;</description></item><item><title>from.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/from/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/from/</guid><description>&lt;h1 id="fromhpp"&gt;
from.hpp
&lt;a class="anchor" href="#fromhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Defines a &lt;code&gt;struct&lt;/code&gt; used for conversion from &lt;code&gt;toml::value&lt;/code&gt; in &lt;code&gt;toml::get&lt;/code&gt; and &lt;code&gt;toml::find&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can achieve the same functionality by adding a &lt;code&gt;from_toml&lt;/code&gt; member function, but for classes where you cannot add member functions, use &lt;code&gt;from&amp;lt;T&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This file does not provide specific implementations. Please specialize this &lt;code&gt;struct&lt;/code&gt; when using.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;from&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="example"&gt;
Example
&lt;a class="anchor" href="#example"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; extlib
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;foo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; a;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string b;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// extlib
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#include&lt;/span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;toml11/from.hpp&amp;gt;&lt;/span&gt;&lt;span style="color:#75715e"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;from&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;extlib&lt;span style="color:#f92672"&gt;::&lt;/span&gt;foo&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; extlib&lt;span style="color:#f92672"&gt;::&lt;/span&gt;foo from_toml(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt; v)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; extlib&lt;span style="color:#f92672"&gt;::&lt;/span&gt;foo{toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;find&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;(v, &lt;span style="color:#e6db74"&gt;&amp;#34;a&amp;#34;&lt;/span&gt;), toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;find&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;(v, &lt;span style="color:#e6db74"&gt;&amp;#34;b&amp;#34;&lt;/span&gt;)};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="related"&gt;
Related
&lt;a class="anchor" href="#related"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://toruniina.github.io/toml11/docs/reference/conversion/"&gt;conversion.hpp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://toruniina.github.io/toml11/docs/reference/into/"&gt;into.hpp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>get.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/get/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/get/</guid><description>&lt;h1 id="gethpp"&gt;
get.hpp
&lt;a class="anchor" href="#gethpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;These are functions for extracting values from &lt;code&gt;toml::value&lt;/code&gt; and performing type conversions if necessary.&lt;/p&gt;
&lt;blockquote class="book-hint info"&gt;
&lt;code&gt;toml::value&lt;/code&gt; can change the type it stores, and &lt;code&gt;toml::get&lt;/code&gt; accommodates these types.
Technically, all functions use &lt;code&gt;toml::basic_value&amp;lt;TC&amp;gt;&lt;/code&gt;.
However, for simplicity, we refer to it as &lt;code&gt;toml::value&lt;/code&gt; in explanations unless a distinction is necessary.
In the documentation, if the template parameter &lt;code&gt;TC&lt;/code&gt; changes the type, assume that types like &lt;code&gt;toml::value::integer_type&lt;/code&gt; will also change accordingly.
&lt;/blockquote&gt;
&lt;h1 id="tomlgett"&gt;
&lt;code&gt;toml::get&amp;lt;T&amp;gt;&lt;/code&gt;
&lt;a class="anchor" href="#tomlgett"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h2 id="overview"&gt;
Overview
&lt;a class="anchor" href="#overview"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Generally, &lt;code&gt;toml::get&lt;/code&gt; behaves as follows:
You specify &lt;code&gt;T&lt;/code&gt; as in &lt;code&gt;toml::get&amp;lt;int&amp;gt;(v)&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>into.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/into/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/into/</guid><description>&lt;h1 id="intohpp"&gt;
into.hpp
&lt;a class="anchor" href="#intohpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Defines a &lt;code&gt;struct&lt;/code&gt; used for conversion from user-defined types into &lt;code&gt;toml::value&lt;/code&gt; constructors.&lt;/p&gt;
&lt;p&gt;You can achieve the same functionality by adding an &lt;code&gt;into_toml&lt;/code&gt; member function, but for classes where you cannot add member functions, use &lt;code&gt;into&amp;lt;T&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This file does not provide specific implementations. Please specialize this &lt;code&gt;struct&lt;/code&gt; when using.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;into&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="example"&gt;
Example
&lt;a class="anchor" href="#example"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; extlib
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;foo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; a;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string b;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// extlib
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#include&lt;/span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;toml11/into.hpp&amp;gt;&lt;/span&gt;&lt;span style="color:#75715e"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;into&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;extlib&lt;span style="color:#f92672"&gt;::&lt;/span&gt;foo&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; into_toml(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; extlib&lt;span style="color:#f92672"&gt;::&lt;/span&gt;foo&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; f)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; value_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; table_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; value_type&lt;span style="color:#f92672"&gt;::&lt;/span&gt;table_type;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;value_type&lt;/span&gt;(table_type{{&lt;span style="color:#e6db74"&gt;&amp;#34;a&amp;#34;&lt;/span&gt;, f.a}, {&lt;span style="color:#e6db74"&gt;&amp;#34;b&amp;#34;&lt;/span&gt;, f.b}});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="related"&gt;
Related
&lt;a class="anchor" href="#related"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://toruniina.github.io/toml11/docs/reference/conversion/"&gt;conversion.hpp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://toruniina.github.io/toml11/docs/reference/from/"&gt;from.hpp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>literal.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/literal/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/literal/</guid><description>&lt;h1 id="literalhpp"&gt;
literal.hpp
&lt;a class="anchor" href="#literalhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;In &lt;code&gt;literal.hpp&lt;/code&gt;, the &lt;code&gt;_toml&lt;/code&gt; literal is defined.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;_toml&lt;/code&gt; literal parses string literals into &lt;code&gt;toml::value&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;inline&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; literals
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;inline&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml_literals
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;value &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt; _toml(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt;&lt;span style="color:#f92672"&gt;*&lt;/span&gt; str, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t len);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;value &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt; _toml(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char8_t&lt;/span&gt;&lt;span style="color:#f92672"&gt;*&lt;/span&gt; str, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t len); &lt;span style="color:#75715e"&gt;// Available in C++20 and later
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;} &lt;span style="color:#75715e"&gt;// toml_literals
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;} &lt;span style="color:#75715e"&gt;// literals
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="free-functions"&gt;
Free Functions
&lt;a class="anchor" href="#free-functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="operator-_tomlconst-char"&gt;
&lt;code&gt;operator&amp;quot;&amp;quot; _toml(const char*)&lt;/code&gt;
&lt;a class="anchor" href="#operator-_tomlconst-char"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;toml&lt;span style="color:#f92672"&gt;::&lt;/span&gt;value &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt; _toml(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt;&lt;span style="color:#f92672"&gt;*&lt;/span&gt; str, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t len);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Converts a string literal into a &lt;code&gt;toml::value&lt;/code&gt; by parsing it.&lt;/p&gt;</description></item><item><title>ordered_map.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/ordered_map/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/ordered_map/</guid><description>&lt;h1 id="ordered_maphpp"&gt;
ordered_map.hpp
&lt;a class="anchor" href="#ordered_maphpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Defines &lt;code&gt;toml::ordered_map&lt;/code&gt;, which is used to maintain the order of values in a file.&lt;/p&gt;
&lt;h1 id="class-ordered_map"&gt;
&lt;code&gt;class ordered_map&lt;/code&gt;
&lt;a class="anchor" href="#class-ordered_map"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; Key, &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; Val, &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; Cmp &lt;span style="color:#f92672"&gt;=&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;equal_to&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;Key&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; Allocator &lt;span style="color:#f92672"&gt;=&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;allocator&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;pair&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;Key, Val&lt;span style="color:#f92672"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ordered_map&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;ordered_map&lt;/code&gt; is a &lt;code&gt;map&lt;/code&gt; type that preserves the insertion order of values, allowing iteration in that order.&lt;/p&gt;
&lt;p&gt;As a linear container, searches require &lt;code&gt;O(n)&lt;/code&gt; time relative to the number of elements.
Use this when search operations are infrequent and maintaining the order of values is important.&lt;/p&gt;</description></item><item><title>parser.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/parser/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/parser/</guid><description>&lt;h1 id="parserhpp"&gt;
parser.hpp
&lt;a class="anchor" href="#parserhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Defines functions for parsing files or strings and the exceptions they use.&lt;/p&gt;
&lt;p&gt;While &lt;code&gt;parse&lt;/code&gt; throws an exception on failure, &lt;code&gt;try_parse&lt;/code&gt; returns error information.&lt;/p&gt;
&lt;h1 id="parse"&gt;
&lt;code&gt;parse&lt;/code&gt;
&lt;a class="anchor" href="#parse"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Parses the content of a given file and returns a &lt;code&gt;toml::basic_value&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In case of failure, &lt;code&gt;toml::syntax_error&lt;/code&gt; is thrown.&lt;/p&gt;
&lt;p&gt;The type information of &lt;code&gt;basic_value&lt;/code&gt; is provided by a &lt;code&gt;template&lt;/code&gt;, and the TOML language version is specified by &lt;code&gt;toml::spec&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="parsestdstring-filename-tomlspec"&gt;
&lt;code&gt;parse(std::string filename, toml::spec)&lt;/code&gt;
&lt;a class="anchor" href="#parsestdstring-filename-tomlspec"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC &lt;span style="color:#f92672"&gt;=&lt;/span&gt; type_config&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;parse(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string fname,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; spec s &lt;span style="color:#f92672"&gt;=&lt;/span&gt; spec&lt;span style="color:#f92672"&gt;::&lt;/span&gt;default_version());
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Parses the content of the given filename.&lt;/p&gt;</description></item><item><title>result.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/result/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/result/</guid><description>&lt;h1 id="resulthpp"&gt;
result.hpp
&lt;a class="anchor" href="#resulthpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;result.hpp&lt;/code&gt; defines the &lt;code&gt;result&lt;/code&gt; type, which can hold either a success value or a failure value.&lt;/p&gt;
&lt;p&gt;This is used as the return type for &lt;code&gt;toml::try_parse&lt;/code&gt;, which does not throw exceptions.&lt;/p&gt;
&lt;h1 id="success"&gt;
success
&lt;a class="anchor" href="#success"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;A type that holds a success value.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;success&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; value_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; T;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;explicit&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;success&lt;/span&gt;(value_type v);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;~&lt;/span&gt;success() &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; success(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; success&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; success(success&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; success&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; success&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; success&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;(success&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; U&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;explicit&lt;/span&gt; success(U&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; v);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; U&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;explicit&lt;/span&gt; success(success&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;U&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; v);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; value_type&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; get() &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; value_type &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; get() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;success&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;decay&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;T&lt;span style="color:#f92672"&gt;&amp;gt;::&lt;/span&gt;type&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; ok(T&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; v);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t N&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;success&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; ok(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt; (&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;literal)[N])
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="member-types"&gt;
Member Types
&lt;a class="anchor" href="#member-types"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; value_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; T;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The type of the success value.&lt;/p&gt;</description></item><item><title>serializer.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/serializer/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/serializer/</guid><description>&lt;h1 id="serializerhpp"&gt;
serializer.hpp
&lt;a class="anchor" href="#serializerhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h2 id="format"&gt;
&lt;code&gt;format&lt;/code&gt;
&lt;a class="anchor" href="#format"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Serializes the data.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string format(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt; v,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; spec s &lt;span style="color:#f92672"&gt;=&lt;/span&gt; spec&lt;span style="color:#f92672"&gt;::&lt;/span&gt;default_version());
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string format(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;::&lt;/span&gt;key_type&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; k,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt; v,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; spec s &lt;span style="color:#f92672"&gt;=&lt;/span&gt; spec&lt;span style="color:#f92672"&gt;::&lt;/span&gt;default_version());
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string format(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;vector&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;::&lt;/span&gt;key_type&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt; ks,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt; v,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; spec s &lt;span style="color:#f92672"&gt;=&lt;/span&gt; spec&lt;span style="color:#f92672"&gt;::&lt;/span&gt;default_version());
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If there&amp;rsquo;s a conflict between the format information and the &lt;code&gt;spec&lt;/code&gt;, for example, when using &lt;code&gt;v1.0.0&lt;/code&gt; with &lt;code&gt;table_format::multiline_oneline&lt;/code&gt;, the &lt;code&gt;spec&lt;/code&gt; takes precedence.&lt;/p&gt;</description></item><item><title>source_location.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/source_location/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/source_location/</guid><description>&lt;h1 id="source_locationhpp"&gt;
source_location.hpp
&lt;a class="anchor" href="#source_locationhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;source_location.hpp&lt;/code&gt; defines a class representing a specific area within a TOML file.&lt;/p&gt;
&lt;p&gt;This class is used to represent problematic areas in error messages.&lt;/p&gt;
&lt;h1 id="tomlsource_location"&gt;
&lt;code&gt;toml::source_location&lt;/code&gt;
&lt;a class="anchor" href="#tomlsource_location"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;source_location&lt;/code&gt; is a class representing a specific area within a TOML file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;source_location&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;explicit&lt;/span&gt; source_location(&lt;span style="color:#75715e"&gt;/* implementation-defined */&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;~&lt;/span&gt;source_location() &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; source_location(source_location &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; source_location(source_location &lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; source_location&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;(source_location &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; source_location&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;(source_location &lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;is_ok&lt;/span&gt;() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t length() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t first_line_number() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t first_column_number() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t last_line_number() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t last_column_number() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; file_name() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;size_t num_lines() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; first_line() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; last_line() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;vector&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; lines() &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; ... Ts&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string format_location(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; source_location&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; loc, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; msg, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; Ts&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; ... locs_and_msgs);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;//toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="member-functions"&gt;
Member Functions
&lt;a class="anchor" href="#member-functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="constructor"&gt;
Constructor
&lt;a class="anchor" href="#constructor"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;explicit&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;source_location&lt;/span&gt;(&lt;span style="color:#75715e"&gt;/* implementation-defined */&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;toml::source_location&lt;/code&gt; can only be constructed via &lt;code&gt;toml::parse&lt;/code&gt; or the &lt;code&gt;_toml&lt;/code&gt; literal.&lt;/p&gt;</description></item><item><title>spec.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/spec/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/spec/</guid><description>&lt;h1 id="spechpp"&gt;
spec.hpp
&lt;a class="anchor" href="#spechpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;spec.hpp&lt;/code&gt; defines classes for specifying the version of TOML.&lt;/p&gt;
&lt;h1 id="tomlsemantic_version"&gt;
&lt;code&gt;toml::semantic_version&lt;/code&gt;
&lt;a class="anchor" href="#tomlsemantic_version"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;semantic_version&lt;/code&gt; is a class that stores version information.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;semantic_version&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;semantic_version&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; mjr, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; mnr, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; p) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; major;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; minor;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; patch;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; semantic_version
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;make_semver&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; major, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; minor, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; patch) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;==&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;!=&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;=&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;=&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; os, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; semantic_version&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; ver);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;//toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="member-functions"&gt;
Member Functions
&lt;a class="anchor" href="#member-functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="constructor"&gt;
Constructor
&lt;a class="anchor" href="#constructor"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;constexpr&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;semantic_version&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; mjr, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; mnr, std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint32_t&lt;/span&gt; p) &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Constructs a &lt;code&gt;semantic_version&lt;/code&gt; instance with the specified &lt;code&gt;major&lt;/code&gt;, &lt;code&gt;minor&lt;/code&gt;, and &lt;code&gt;patch&lt;/code&gt; version numbers.&lt;/p&gt;</description></item><item><title>toml_fwd.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/toml_fwd/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/toml_fwd/</guid><description>&lt;h1 id="toml_fwdhpp"&gt;
toml_fwd.hpp
&lt;a class="anchor" href="#toml_fwdhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;toml_fwd.hpp&lt;/code&gt; contains forward declarations of structures defined in toml11 and macro definitions.&lt;/p&gt;
&lt;p&gt;When only forward declarations of toml11 structures are needed and implementation is not required, including &lt;code&gt;toml_fwd.hpp&lt;/code&gt; instead of &lt;code&gt;toml.hpp&lt;/code&gt; can reduce compilation time.&lt;/p&gt;
&lt;blockquote class="book-hint warning"&gt;
Since this file only contains forward declarations, you cannot use &lt;code&gt;toml::table&lt;/code&gt;, defined as &lt;code&gt;toml::basic_value&amp;lt;toml::type_config&amp;gt;::table_type&lt;/code&gt;, and similarly defined &lt;code&gt;toml::array&lt;/code&gt;. This is because they require the implementation of &lt;code&gt;basic_value&lt;/code&gt;.
&lt;/blockquote&gt;
&lt;p&gt;This header file and &lt;code&gt;toml.hpp&lt;/code&gt; are located under &lt;code&gt;${TOML11_INCLUDE_DIR}/&lt;/code&gt;, while other header files are located under &lt;code&gt;${TOML11_INCLUDE_DIR}/toml11/&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>toml.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/toml/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/toml/</guid><description>&lt;h1 id="tomlhpp"&gt;
toml.hpp
&lt;a class="anchor" href="#tomlhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;toml.hpp&lt;/code&gt; includes all other headers.&lt;/p&gt;
&lt;p&gt;This allows access to all features of toml11.&lt;/p&gt;
&lt;p&gt;This header file and &lt;code&gt;toml_fwd.hpp&lt;/code&gt; are located under &lt;code&gt;${TOML11_INCLUDE_DIR}/&lt;/code&gt;,
while other header files are located under &lt;code&gt;${toml11_include_dir}/toml11/&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>types.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/types/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/types/</guid><description>&lt;h1 id="typeshpp"&gt;
types.hpp
&lt;a class="anchor" href="#typeshpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;This document defines classes that specifies type information.&lt;/p&gt;
&lt;h1 id="type_config"&gt;
&lt;code&gt;type_config&lt;/code&gt;
&lt;a class="anchor" href="#type_config"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;type_config&lt;/code&gt; is a type that encapsulates parameters given to &lt;code&gt;toml::basic_value&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When using different types within &lt;code&gt;toml::basic_value&amp;lt;T&amp;gt;&lt;/code&gt;, you need to define and pass this type separately.
All elements listed are required.&lt;/p&gt;
&lt;p&gt;If you use numerical types that cannot use standard stream operators, define and replace the equivalents for &lt;code&gt;read_int&lt;/code&gt; and &lt;code&gt;read_float&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;type_config&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; comment_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; preserve_comments;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; boolean_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; integer_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;int64_t&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; floating_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;double&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; string_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; array_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;vector&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; K, &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; table_type &lt;span style="color:#f92672"&gt;=&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;unordered_map&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;K, T&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; result&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;integer_type, error_info&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; parse_int(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; str, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; source_location src, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint8_t&lt;/span&gt; base);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; result&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;floating_type, error_info&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; parse_float(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; str, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; source_location src, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; is_hex);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; value &lt;span style="color:#f92672"&gt;=&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;type_config&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; table &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; value&lt;span style="color:#f92672"&gt;::&lt;/span&gt;table_type;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; array &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; value&lt;span style="color:#f92672"&gt;::&lt;/span&gt;array_type;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="static-member-functions"&gt;
&lt;code&gt;static&lt;/code&gt; Member Functions
&lt;a class="anchor" href="#static-member-functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="parse_intstr-src-base"&gt;
&lt;code&gt;parse_int(str, src, base)&lt;/code&gt;
&lt;a class="anchor" href="#parse_intstr-src-base"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; result&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;integer_type, error_info&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;parse_int(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; str, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; source_location src, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint8_t&lt;/span&gt; base);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you use a type as &lt;code&gt;integer_type&lt;/code&gt; that cannot utilize standard stream operators, implement this function.
Otherwise, use &lt;code&gt;read_int&lt;/code&gt; described later.&lt;/p&gt;</description></item><item><title>value_t.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/value_t/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/value_t/</guid><description>&lt;h1 id="value_thpp"&gt;
value_t.hpp
&lt;a class="anchor" href="#value_thpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h1 id="value_t"&gt;
&lt;code&gt;value_t&lt;/code&gt;
&lt;a class="anchor" href="#value_t"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;value_t&lt;/code&gt; is used to handle the type information of &lt;code&gt;toml::value&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;enum&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;value_t&lt;/span&gt; &lt;span style="color:#f92672"&gt;:&lt;/span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;uint8_t&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; empty &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; boolean &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; integer &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; floating &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; string &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; offset_datetime &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; local_datetime &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;6&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; local_date &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;7&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; local_time &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; array &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; table &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; os, value_t t);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;string to_string(value_t t);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="non-member-functions"&gt;
Non-member Functions
&lt;a class="anchor" href="#non-member-functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="stream-operator"&gt;
Stream Operator
&lt;a class="anchor" href="#stream-operator"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt;(std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;ostream&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; os, value_t t);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Outputs the string representation of the &lt;code&gt;value_t&lt;/code&gt; to the stream.&lt;/p&gt;</description></item><item><title>value.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/value/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/value/</guid><description>&lt;h1 id="valuehpp"&gt;
value.hpp
&lt;a class="anchor" href="#valuehpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;value.hpp&lt;/code&gt; defines &lt;code&gt;basic_value&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id="tomlbasic_value"&gt;
&lt;code&gt;toml::basic_value&lt;/code&gt;
&lt;a class="anchor" href="#tomlbasic_value"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;basic_value&lt;/code&gt; is a class that stores TOML values.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;TypeConfig&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;basic_value&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Defined in types.hpp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// using value = basic_value&amp;lt;type_config&amp;gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// using table = typename basic_value&amp;lt;type_config&amp;gt;::table_type;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// using array = typename basic_value&amp;lt;type_config&amp;gt;::array_type;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;==&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;!=&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;=&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; TC&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;operator&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;=&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; basic_value&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;TC&lt;span style="color:#f92672"&gt;&amp;gt;&amp;amp;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;//toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="member-types"&gt;
Member Types
&lt;a class="anchor" href="#member-types"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The following member types are defined.&lt;/p&gt;</description></item><item><title>version.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/version/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/version/</guid><description>&lt;h1 id="versionhpp"&gt;
version.hpp
&lt;a class="anchor" href="#versionhpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;In &lt;code&gt;version.hpp&lt;/code&gt;, macros related to the version information of toml11 are defined.&lt;/p&gt;
&lt;h2 id="macros"&gt;
Macros
&lt;a class="anchor" href="#macros"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="toml11_version_major"&gt;
&lt;code&gt;TOML11_VERSION_MAJOR&lt;/code&gt;
&lt;a class="anchor" href="#toml11_version_major"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The major version of toml11.&lt;/p&gt;
&lt;h3 id="toml11_version_minor"&gt;
&lt;code&gt;TOML11_VERSION_MINOR&lt;/code&gt;
&lt;a class="anchor" href="#toml11_version_minor"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The minor version of toml11.&lt;/p&gt;
&lt;h3 id="toml11_version_patch"&gt;
&lt;code&gt;TOML11_VERSION_PATCH&lt;/code&gt;
&lt;a class="anchor" href="#toml11_version_patch"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The patch version of toml11.&lt;/p&gt;
&lt;h2 id="function"&gt;
Function
&lt;a class="anchor" href="#function"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="license_notice"&gt;
&lt;code&gt;license_notice&lt;/code&gt;
&lt;a class="anchor" href="#license_notice"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt;&lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;license_notice&lt;/span&gt;() &lt;span style="color:#66d9ef"&gt;noexcept&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Returns the license notice.&lt;/p&gt;
&lt;p&gt;Provided for convenience when redistributing without source code.&lt;/p&gt;</description></item><item><title>visit.hpp</title><link>https://toruniina.github.io/toml11/docs/reference/visit/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://toruniina.github.io/toml11/docs/reference/visit/</guid><description>&lt;h1 id="visithpp"&gt;
visit.hpp
&lt;a class="anchor" href="#visithpp"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;In &lt;code&gt;visit.hpp&lt;/code&gt;, &lt;code&gt;toml::visit&lt;/code&gt; is defined.&lt;/p&gt;
&lt;h1 id="tomlvisit"&gt;
&lt;code&gt;toml::visit&lt;/code&gt;
&lt;a class="anchor" href="#tomlvisit"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;h2 id="functions"&gt;
Functions
&lt;a class="anchor" href="#functions"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; toml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;template&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; Visitor, &lt;span style="color:#66d9ef"&gt;typename&lt;/span&gt; ... Args&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;/* Return value when Visitor is called with a value of basic_value&amp;lt;TC&amp;gt; */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;visit(Visitor&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; visitor, Args&lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ... args);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;toml::visit&lt;/code&gt; calls the overload of &lt;code&gt;Visitor&lt;/code&gt; corresponding to the type held by &lt;code&gt;basic_value&amp;lt;TC&amp;gt;&lt;/code&gt;, and returns the result.&lt;/p&gt;
&lt;h4 id="requirements"&gt;
Requirements
&lt;a class="anchor" href="#requirements"&gt;#&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;Visitor&lt;/code&gt; must be a function or function object callable with any type held by &lt;code&gt;basic_value&amp;lt;TC&amp;gt;&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>

View File

@@ -0,0 +1,96 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content='
into.hpp
#
Defines a struct used for conversion from user-defined types into toml::value constructors.
You can achieve the same functionality by adding an into_toml member function, but for classes where you cannot add member functions, use into<T>.
This file does not provide specific implementations. Please specialize this struct when using.
namespace toml
{
template<typename T>
struct into;
} // toml
Example
#
namespace extlib
{
struct foo
{
int a;
std::string b;
};
} // extlib
#include <toml11/into.hpp>
namespace toml
{
template<>
struct into<extlib::foo>
{
template<typename TC>
static toml::basic_value<TC> into_toml(const extlib::foo& f)
{
using value_type = toml::basic_value<TC>;
using table_type = typename value_type::table_type;
return value_type(table_type{{"a", f.a}, {"b", f.b}});
}
};
} // toml
Related
#
conversion.hpp
from.hpp
'><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/into/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="into.hpp"><meta property="og:description" content='into.hpp # Defines a struct used for conversion from user-defined types into toml::value constructors.
You can achieve the same functionality by adding an into_toml member function, but for classes where you cannot add member functions, use into<T>.
This file does not provide specific implementations. Please specialize this struct when using.
namespace toml { template<typename T> struct into; } // toml Example # namespace extlib { struct foo { int a; std::string b; }; } // extlib #include <toml11/into.hpp> namespace toml { template<> struct into<extlib::foo> { template<typename TC> static toml::basic_value<TC> into_toml(const extlib::foo& f) { using value_type = toml::basic_value<TC>; using table_type = typename value_type::table_type; return value_type(table_type{{"a", f.a}, {"b", f.b}}); } }; } // toml Related # conversion.hpp from.hpp'><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>into.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/into/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/into/ title=into.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/into/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/ class=active>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>into.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#intohpp>into.hpp</a><ul><li><a href=#example>Example</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=intohpp>into.hpp
<a class=anchor href=#intohpp>#</a></h1><p>Defines a <code>struct</code> used for conversion from user-defined types into <code>toml::value</code> constructors.</p><p>You can achieve the same functionality by adding an <code>into_toml</code> member function, but for classes where you cannot add member functions, use <code>into&lt;T></code>.</p><p>This file does not provide specific implementations. Please specialize this <code>struct</code> when using.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>into</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h2 id=example>Example
<a class=anchor href=#example>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> extlib
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>foo</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>int</span> a;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string b;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>} <span style=color:#75715e>// extlib
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml11/into.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>into</span><span style=color:#f92672>&lt;</span>extlib<span style=color:#f92672>::</span>foo<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>static</span> toml<span style=color:#f92672>::</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span> into_toml(<span style=color:#66d9ef>const</span> extlib<span style=color:#f92672>::</span>foo<span style=color:#f92672>&amp;</span> f)
</span></span><span style=display:flex><span> {
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> table_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> value_type<span style=color:#f92672>::</span>table_type;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#a6e22e>value_type</span>(table_type{{<span style=color:#e6db74>&#34;a&#34;</span>, f.a}, {<span style=color:#e6db74>&#34;b&#34;</span>, f.b}});
</span></span><span style=display:flex><span> }
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/from/>from.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#intohpp>into.hpp</a><ul><li><a href=#example>Example</a></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,69 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content='
literal.hpp
#
In literal.hpp, the _toml literal is defined.
The _toml literal parses string literals into toml::value.
namespace toml
{
inline namespace literals
{
inline namespace toml_literals
{
toml::value operator"" _toml(const char* str, std::size_t len);
toml::value operator"" _toml(const char8_t* str, std::size_t len); // Available in C++20 and later
} // toml_literals
} // literals
} // toml
Free Functions
#
operator"" _toml(const char*)
#
toml::value operator"" _toml(const char* str, std::size_t len);
Converts a string literal into a toml::value by parsing it.'><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/literal/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="literal.hpp"><meta property="og:description" content='literal.hpp # In literal.hpp, the _toml literal is defined.
The _toml literal parses string literals into toml::value.
namespace toml { inline namespace literals { inline namespace toml_literals { toml::value operator"" _toml(const char* str, std::size_t len); toml::value operator"" _toml(const char8_t* str, std::size_t len); // Available in C++20 and later } // toml_literals } // literals } // toml Free Functions # operator"" _toml(const char*) # toml::value operator"" _toml(const char* str, std::size_t len); Converts a string literal into a toml::value by parsing it.'><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>literal.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/literal/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/literal/ title=literal.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/literal/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/ class=active>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>literal.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#literalhpp>literal.hpp</a><ul><li><a href=#free-functions>Free Functions</a><ul><li><a href=#operator-_tomlconst-char><code>operator"" _toml(const char*)</code></a></li><li><a href=#operator-_tomlconst-char8_t><code>operator"" _toml(const char8_t*)</code></a></li></ul></li></ul></li><li><a href=#example>Example</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=literalhpp>literal.hpp
<a class=anchor href=#literalhpp>#</a></h1><p>In <code>literal.hpp</code>, the <code>_toml</code> literal is defined.</p><p>The <code>_toml</code> literal parses string literals into <code>toml::value</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>inline</span> <span style=color:#66d9ef>namespace</span> literals
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>inline</span> <span style=color:#66d9ef>namespace</span> toml_literals
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span>toml<span style=color:#f92672>::</span>value <span style=color:#66d9ef>operator</span><span style=color:#e6db74>&#34;&#34;</span> _toml(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> str, std<span style=color:#f92672>::</span>size_t len);
</span></span><span style=display:flex><span>toml<span style=color:#f92672>::</span>value <span style=color:#66d9ef>operator</span><span style=color:#e6db74>&#34;&#34;</span> _toml(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char8_t</span><span style=color:#f92672>*</span> str, std<span style=color:#f92672>::</span>size_t len); <span style=color:#75715e>// Available in C++20 and later
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>} <span style=color:#75715e>// toml_literals
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>} <span style=color:#75715e>// literals
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h2 id=free-functions>Free Functions
<a class=anchor href=#free-functions>#</a></h2><h3 id=operator-_tomlconst-char><code>operator"" _toml(const char*)</code>
<a class=anchor href=#operator-_tomlconst-char>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>toml<span style=color:#f92672>::</span>value <span style=color:#66d9ef>operator</span><span style=color:#e6db74>&#34;&#34;</span> _toml(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> str, std<span style=color:#f92672>::</span>size_t len);
</span></span></code></pre></div><p>Converts a string literal into a <code>toml::value</code> by parsing it.</p><p>For typical TOML files, this performs equivalent parsing to <code>toml::parse</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> v1 <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;a = &#39;foo&#39;&#34;</span>_toml; <span style=color:#75715e>// v1: {a = &#39;foo&#39;}
</span></span></span></code></pre></div><p>When dealing with multiline content, raw string literal is convenient.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> v1 <span style=color:#f92672>=</span> R<span style=color:#e6db74>&#34;(</span>
</span></span><span style=display:flex><span> a <span style=color:#f92672>=</span> <span style=color:#ae81ff>42</span>
</span></span><span style=display:flex><span> b <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;foo&#34;</span>
</span></span><span style=display:flex><span>)<span style=color:#e6db74>&#34;_toml;</span>
</span></span></code></pre></div><p>If the value is a standalone entity, it represents that value.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> v2 <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;&#39;foo&#39;&#34;</span>_toml; <span style=color:#75715e>// v2: &#39;foo&#39;
</span></span></span></code></pre></div><p>TOML allows keys consisting solely of numbers. When distinguishing between table definitions and arrays is ambiguous (e.g., <code>[1]</code>), table definitions take precedence.</p><p>To interpret as an array, use a trailing comma.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> v3 <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;[1]&#34;</span>_toml; <span style=color:#75715e>// v3: {1 = {}}
</span></span></span><span style=display:flex><span><span style=color:#75715e></span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> v4 <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;[1,]&#34;</span>_toml; <span style=color:#75715e>// v4: [1,]
</span></span></span></code></pre></div><h3 id=operator-_tomlconst-char8_t><code>operator"" _toml(const char8_t*)</code>
<a class=anchor href=#operator-_tomlconst-char8_t>#</a></h3><p>Defined when <code>char8_t</code> is available. Otherwise identical in functionality, differing only in argument type.</p><h1 id=example>Example
<a class=anchor href=#example>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span><span style=color:#66d9ef>int</span> <span style=color:#a6e22e>main</span>()
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> <span style=color:#66d9ef>namespace</span> toml<span style=color:#f92672>::</span>literals<span style=color:#f92672>::</span>toml_literals;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> v <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;a = </span><span style=color:#ae81ff>\&#34;</span><span style=color:#e6db74>foo</span><span style=color:#ae81ff>\&#34;</span><span style=color:#e6db74>&#34;</span>_toml;
</span></span><span style=display:flex><span> assert(v.at(<span style=color:#e6db74>&#34;a&#34;</span>).as_string() <span style=color:#f92672>==</span> <span style=color:#e6db74>&#34;foo&#34;</span>);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#ae81ff>0</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#literalhpp>literal.hpp</a><ul><li><a href=#free-functions>Free Functions</a><ul><li><a href=#operator-_tomlconst-char><code>operator"" _toml(const char*)</code></a></li><li><a href=#operator-_tomlconst-char8_t><code>operator"" _toml(const char8_t*)</code></a></li></ul></li></ul></li><li><a href=#example>Example</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,158 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
ordered_map.hpp
#
Defines toml::ordered_map, which is used to maintain the order of values in a file.
class ordered_map
#
namespace toml
{
template<typename Key, typename Val, typename Cmp = std::equal_to<Key>,
typename Allocator = std::allocator<std::pair<Key, Val>>>
class ordered_map;
}
The ordered_map is a map type that preserves the insertion order of values, allowing iteration in that order.
As a linear container, searches require O(n) time relative to the number of elements.
Use this when search operations are infrequent and maintaining the order of values is important."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/ordered_map/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="ordered_map.hpp"><meta property="og:description" content="ordered_map.hpp # Defines toml::ordered_map, which is used to maintain the order of values in a file.
class ordered_map # namespace toml { template<typename Key, typename Val, typename Cmp = std::equal_to<Key>, typename Allocator = std::allocator<std::pair<Key, Val>>> class ordered_map; } The ordered_map is a map type that preserves the insertion order of values, allowing iteration in that order.
As a linear container, searches require O(n) time relative to the number of elements. Use this when search operations are infrequent and maintaining the order of values is important."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>ordered_map.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/ordered_map/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/ordered_map/ title=ordered_map.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/ordered_map/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/ class=active>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>ordered_map.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#ordered_maphpp>ordered_map.hpp</a></li><li><a href=#class-ordered_map><code>class ordered_map</code></a><ul><li><a href=#non-member-types>Non-Member Types</a></li><li><a href=#member-types>Member Types</a></li><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructors>Constructors</a></li><li><a href=#constructors-comparator-allocator>Constructors (Comparator, Allocator)</a></li><li><a href=#copy-and-move-constructors>Copy and Move Constructors</a></li><li><a href=#constructors-iterator>Constructors (Iterator)</a></li><li><a href=#constructors-stdinitializer_list>Constructors (std::initializer_list)</a></li><li><a href=#copy-and-move-assignment-operators>Copy and Move Assignment Operators</a></li><li><a href=#assignment-operator-stdinitializer_list>Assignment Operator (std::initializer_list)</a></li><li><a href=#destructor>Destructor</a></li><li><a href=#begin-end><code>begin()</code>, <code>end()</code></a></li><li><a href=#empty><code>empty()</code></a></li><li><a href=#size><code>size()</code></a></li><li><a href=#max_size><code>max_size()</code></a></li><li><a href=#clear><code>clear()</code></a></li><li><a href=#push_backkv><code>push_back(kv)</code></a></li><li><a href=#emplace_backk-v><code>emplace_back(k, v)</code></a></li><li><a href=#pop_back><code>pop_back()</code></a></li><li><a href=#insertkv><code>insert(kv)</code></a></li><li><a href=#emplacek-v><code>emplace(k, v)</code></a></li><li><a href=#countk><code>count(k)</code></a></li><li><a href=#containsk><code>contains(k)</code></a></li><li><a href=#findk><code>find(k)</code></a></li><li><a href=#atk><code>at(k)</code></a></li><li><a href=#operatork><code>operator[](k)</code></a></li><li><a href=#erase><code>erase(...)</code></a></li><li><a href=#key_comp><code>key_comp()</code></a></li></ul></li><li><a href=#notes>Notes</a><ul><li><a href=#key-modification>Key Modification</a></li><li><a href=#order-preservation-details>Order Preservation Details</a></li></ul></li><li><a href=#related>Related</a></li></ul></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=ordered_maphpp>ordered_map.hpp
<a class=anchor href=#ordered_maphpp>#</a></h1><p>Defines <code>toml::ordered_map</code>, which is used to maintain the order of values in a file.</p><h1 id=class-ordered_map><code>class ordered_map</code>
<a class=anchor href=#class-ordered_map>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> Key, <span style=color:#66d9ef>typename</span> Val, <span style=color:#66d9ef>typename</span> Cmp <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>equal_to<span style=color:#f92672>&lt;</span>Key<span style=color:#f92672>&gt;</span>,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>typename</span> Allocator <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>allocator<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>pair<span style=color:#f92672>&lt;</span>Key, Val<span style=color:#f92672>&gt;&gt;&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>class</span> <span style=color:#a6e22e>ordered_map</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>The <code>ordered_map</code> is a <code>map</code> type that preserves the insertion order of values, allowing iteration in that order.</p><p>As a linear container, searches require <code>O(n)</code> time relative to the number of elements.
Use this when search operations are infrequent and maintaining the order of values is important.</p><h2 id=non-member-types>Non-Member Types
<a class=anchor href=#non-member-types>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>ordered_type_config</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_value <span style=color:#f92672>=</span> basic_value<span style=color:#f92672>&lt;</span>ordered_type_config<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_table <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> ordered_value<span style=color:#f92672>::</span>table_type;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_array <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> ordered_value<span style=color:#f92672>::</span>array_type;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Use these in place of <code>toml::type_config</code> and <code>toml::value</code>.</p><blockquote class="book-hint info"><p>Since <code>toml::parse</code> defaults to using <code>type_config</code>, specify</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>auto</span> input <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>parse<span style=color:#f92672>&lt;</span>toml<span style=color:#f92672>::</span>ordered_type_config<span style=color:#f92672>&gt;</span>(<span style=color:#e6db74>&#34;input.toml&#34;</span>);
</span></span></code></pre></div><p>when parsing.</p></blockquote><h2 id=member-types>Member Types
<a class=anchor href=#member-types>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>using</span> key_type <span style=color:#f92672>=</span> Key;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> mapped_type <span style=color:#f92672>=</span> Val;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>pair<span style=color:#f92672>&lt;</span>Key, Val<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> key_compare <span style=color:#f92672>=</span> Cmp;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> allocator_type <span style=color:#f92672>=</span> Allocator;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> container_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>value_type, Allocator<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> reference <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>reference;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> pointer <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>pointer;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> const_reference <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>const_reference;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> const_pointer <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>const_pointer;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> iterator <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>iterator;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> const_iterator <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>const_iterator;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> size_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>size_type;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> difference_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> container_type<span style=color:#f92672>::</span>difference_type;
</span></span></code></pre></div><h2 id=member-functions>Member Functions
<a class=anchor href=#member-functions>#</a></h2><h3 id=constructors>Constructors
<a class=anchor href=#constructors>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>ordered_map() <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span></code></pre></div><p>Constructs an empty <code>ordered_map</code>.</p><h3 id=constructors-comparator-allocator>Constructors (Comparator, Allocator)
<a class=anchor href=#constructors-comparator-allocator>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>ordered_map</span>(<span style=color:#66d9ef>const</span> Cmp<span style=color:#f92672>&amp;</span> cmp, <span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc <span style=color:#f92672>=</span> Allocator());
</span></span><span style=display:flex><span><span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>ordered_map</span>(<span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc);
</span></span></code></pre></div><p>Constructs an <code>ordered_map</code> with a specified comparator for key comparison and an allocator for memory management.</p><h3 id=copy-and-move-constructors>Copy and Move Constructors
<a class=anchor href=#copy-and-move-constructors>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>ordered_map(<span style=color:#66d9ef>const</span> ordered_map<span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>ordered_map(ordered_map<span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>ordered_map(<span style=color:#66d9ef>const</span> ordered_map<span style=color:#f92672>&amp;</span> other, <span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc);
</span></span><span style=display:flex><span>ordered_map(ordered_map<span style=color:#f92672>&amp;&amp;</span> other, <span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc);
</span></span></code></pre></div><p>Constructs an <code>ordered_map</code> by copying or moving the contents from another <code>ordered_map</code>.
An allocator can also be specified for memory management.</p><h3 id=constructors-iterator>Constructors (Iterator)
<a class=anchor href=#constructors-iterator>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> InputIterator<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>ordered_map(InputIterator first, InputIterator last, <span style=color:#66d9ef>const</span> Cmp<span style=color:#f92672>&amp;</span> cmp <span style=color:#f92672>=</span> Cmp(), <span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc <span style=color:#f92672>=</span> Allocator());
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> InputIterator<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>ordered_map(InputIterator first, InputIterator last, <span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc <span style=color:#f92672>=</span> Allocator());
</span></span></code></pre></div><p>Constructs an <code>ordered_map</code> with a range represented by iterators.
The order of the elements follows the order of the iterators.</p><h3 id=constructors-stdinitializer_list>Constructors (std::initializer_list)
<a class=anchor href=#constructors-stdinitializer_list>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>ordered_map(std<span style=color:#f92672>::</span>initializer_list<span style=color:#f92672>&lt;</span>value_type<span style=color:#f92672>&gt;</span> v, <span style=color:#66d9ef>const</span> Cmp<span style=color:#f92672>&amp;</span> cmp <span style=color:#f92672>=</span> Cmp(), <span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc <span style=color:#f92672>=</span> Allocator());
</span></span><span style=display:flex><span>ordered_map(std<span style=color:#f92672>::</span>initializer_list<span style=color:#f92672>&lt;</span>value_type<span style=color:#f92672>&gt;</span> v, <span style=color:#66d9ef>const</span> Allocator<span style=color:#f92672>&amp;</span> alloc);
</span></span></code></pre></div><p>Initializes the <code>ordered_map</code> using an initializer list.</p><h3 id=copy-and-move-assignment-operators>Copy and Move Assignment Operators
<a class=anchor href=#copy-and-move-assignment-operators>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>ordered_map<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(<span style=color:#66d9ef>const</span> ordered_map<span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>ordered_map<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(ordered_map<span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span></code></pre></div><p>Assigns the contents of another <code>ordered_map</code> to this one, using copy or move semantics.</p><h3 id=assignment-operator-stdinitializer_list>Assignment Operator (std::initializer_list)
<a class=anchor href=#assignment-operator-stdinitializer_list>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>ordered_map<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(std<span style=color:#f92672>::</span>initializer_list<span style=color:#f92672>&lt;</span>value_type<span style=color:#f92672>&gt;</span> v);
</span></span></code></pre></div><p>Assigns the contents of an initializer list to the <code>ordered_map</code>.</p><h3 id=destructor>Destructor
<a class=anchor href=#destructor>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#f92672>~</span>ordered_map() <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span></code></pre></div><p>Destroys the <code>ordered_map</code>.</p><h3 id=begin-end><code>begin()</code>, <code>end()</code>
<a class=anchor href=#begin-end>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>iterator <span style=color:#a6e22e>begin</span>() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>iterator <span style=color:#a6e22e>end</span>() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>const_iterator <span style=color:#a6e22e>begin</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>const_iterator <span style=color:#a6e22e>end</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>const_iterator <span style=color:#a6e22e>cbegin</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>const_iterator <span style=color:#a6e22e>cend</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns iterators to the beginning and end of the container, allowing iteration over its contents in order.</p><h3 id=empty><code>empty()</code>
<a class=anchor href=#empty>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>empty</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns <code>true</code> if the <code>ordered_map</code> is empty, <code>false</code> otherwise.</p><h3 id=size><code>size()</code>
<a class=anchor href=#size>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t size() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the number of elements in the <code>ordered_map</code>.</p><h3 id=max_size><code>max_size()</code>
<a class=anchor href=#max_size>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t max_size() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the maximum number of elements the <code>ordered_map</code> can hold.</p><h3 id=clear><code>clear()</code>
<a class=anchor href=#clear>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>clear</span>();
</span></span></code></pre></div><p>Clears all elements from the <code>ordered_map</code>.</p><h3 id=push_backkv><code>push_back(kv)</code>
<a class=anchor href=#push_backkv>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>push_back</span>(<span style=color:#66d9ef>const</span> value_type<span style=color:#f92672>&amp;</span>);
</span></span><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>push_back</span>(value_type<span style=color:#f92672>&amp;&amp;</span>);
</span></span></code></pre></div><p>Appends a key-value pair to the end of the <code>ordered_map</code>.</p><h3 id=emplace_backk-v><code>emplace_back(k, v)</code>
<a class=anchor href=#emplace_backk-v>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>emplace_back</span>(key_type, mapped_type);
</span></span></code></pre></div><p>Appends a key-value pair to the end of the <code>ordered_map</code> by constructing it in place.</p><h3 id=pop_back><code>pop_back()</code>
<a class=anchor href=#pop_back>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>pop_back</span>();
</span></span></code></pre></div><p>Removes the last element from the <code>ordered_map</code>.</p><h3 id=insertkv><code>insert(kv)</code>
<a class=anchor href=#insertkv>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>insert</span>(value_type);
</span></span></code></pre></div><p>Inserts a key-value pair at the end of the <code>ordered_map</code>.</p><h3 id=emplacek-v><code>emplace(k, v)</code>
<a class=anchor href=#emplacek-v>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>emplace</span>(key_type, mapped_type);
</span></span></code></pre></div><p>Inserts a key-value pair at the end of the <code>ordered_map</code> by constructing it in place.</p><h3 id=countk><code>count(k)</code>
<a class=anchor href=#countk>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t count(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the number of elements with the specified key.
Since duplicate keys are not allowed, this will return either <code>1</code> if the key exists or <code>0</code> if it does not.</p><h3 id=containsk><code>contains(k)</code>
<a class=anchor href=#containsk>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>contains</span>(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns <code>true</code> if the <code>ordered_map</code> contains an element with the specified key, <code>false</code> otherwise.</p><h3 id=findk><code>find(k)</code>
<a class=anchor href=#findk>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>iterator <span style=color:#a6e22e>find</span>(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> key) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>const_iterator <span style=color:#a6e22e>find</span>(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> key) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Finds an element with the specified key and returns an iterator to it. If the key is not found, returns <code>end()</code>.</p><h3 id=atk><code>at(k)</code>
<a class=anchor href=#atk>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>mapped_type<span style=color:#f92672>&amp;</span> at(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> k);
</span></span><span style=display:flex><span>mapped_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> at(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> k) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><p>Finds an element with the specified key and returns a reference to its value. Throws <code>std::out_of_range</code> if the key is not found.</p><h3 id=operatork><code>operator[](k)</code>
<a class=anchor href=#operatork>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>mapped_type<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span>[](<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> k);
</span></span><span style=display:flex><span>mapped_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span>[](<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> k) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><p>Finds an element with the specified key and returns a reference to its value.
If the key is not found, a new value is constructed and returned.
If the <code>ordered_map</code> is <code>const</code>, throws <code>std::out_of_range</code> instead.</p><h3 id=erase><code>erase(...)</code>
<a class=anchor href=#erase>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>iterator <span style=color:#a6e22e>erase</span>(iterator pos);
</span></span><span style=display:flex><span>iterator <span style=color:#a6e22e>erase</span>(const_iterator pos);
</span></span><span style=display:flex><span>iterator <span style=color:#a6e22e>erase</span>(const_iterator first, const_iterator last);
</span></span><span style=display:flex><span>size_type <span style=color:#a6e22e>erase</span>(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> key);
</span></span></code></pre></div><p>Removes values pointed by an iterator or a value corresponding to a key.</p><h3 id=key_comp><code>key_comp()</code>
<a class=anchor href=#key_comp>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>key_compare <span style=color:#a6e22e>key_comp</span>() <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><p>Returns the comparator used for key comparison.</p><h2 id=notes>Notes
<a class=anchor href=#notes>#</a></h2><h3 id=key-modification>Key Modification
<a class=anchor href=#key-modification>#</a></h3><blockquote class="book-hint warning"><p>Since <code>ordered_map</code> uses <code>std::pair&lt;Key, Val></code> for <code>value_type</code>, it is possible to modify the key through an iterator. However, this practice is not recommended.</p><p>If you modify a key this way and it conflicts with an existing key, one of the conflicting keys will become unsearchable.</p><p>When using <code>operator[]</code>, <code>push_back</code>, or <code>insert</code>, collisions with existing keys are detected.</p></blockquote><h3 id=order-preservation-details>Order Preservation Details
<a class=anchor href=#order-preservation-details>#</a></h3><blockquote class="book-hint warning"><p><code>ordered_map</code> maintains the order of keys, but this order preservation applies only to keys defined within the same table. Order across different tables is not maintained.</p><p>For example, the order in the following file will be preserved:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>apple.type <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;fruit&#34;</span>
</span></span><span style=display:flex><span>apple.skin <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;thin&#34;</span>
</span></span><span style=display:flex><span>apple.color <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;red&#34;</span>
</span></span><span style=display:flex><span>orange.type <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;fruit&#34;</span>
</span></span><span style=display:flex><span>orange.skin <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;thick&#34;</span>
</span></span><span style=display:flex><span>orange.color <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;orange&#34;</span>
</span></span></code></pre></div><p>In contrast, the order in the following file will not be preserved:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>apple.type <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;fruit&#34;</span>
</span></span><span style=display:flex><span>orange.type <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;fruit&#34;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>apple.skin <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;thin&#34;</span>
</span></span><span style=display:flex><span>orange.skin <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;thick&#34;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>apple.color <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;red&#34;</span>
</span></span><span style=display:flex><span>orange.color <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;orange&#34;</span>
</span></span></code></pre></div><p><code>ordered_map</code> preserves the order of the <code>apple</code> and <code>orange</code> definitions at the root table level, and the order of <code>type</code>, <code>skin</code>, <code>color</code> within each <code>apple</code> and <code>orange</code> table.</p></blockquote><h2 id=related>Related
<a class=anchor href=#related>#</a></h2><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/types/>types.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/value/>value.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#ordered_maphpp>ordered_map.hpp</a></li><li><a href=#class-ordered_map><code>class ordered_map</code></a><ul><li><a href=#non-member-types>Non-Member Types</a></li><li><a href=#member-types>Member Types</a></li><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructors>Constructors</a></li><li><a href=#constructors-comparator-allocator>Constructors (Comparator, Allocator)</a></li><li><a href=#copy-and-move-constructors>Copy and Move Constructors</a></li><li><a href=#constructors-iterator>Constructors (Iterator)</a></li><li><a href=#constructors-stdinitializer_list>Constructors (std::initializer_list)</a></li><li><a href=#copy-and-move-assignment-operators>Copy and Move Assignment Operators</a></li><li><a href=#assignment-operator-stdinitializer_list>Assignment Operator (std::initializer_list)</a></li><li><a href=#destructor>Destructor</a></li><li><a href=#begin-end><code>begin()</code>, <code>end()</code></a></li><li><a href=#empty><code>empty()</code></a></li><li><a href=#size><code>size()</code></a></li><li><a href=#max_size><code>max_size()</code></a></li><li><a href=#clear><code>clear()</code></a></li><li><a href=#push_backkv><code>push_back(kv)</code></a></li><li><a href=#emplace_backk-v><code>emplace_back(k, v)</code></a></li><li><a href=#pop_back><code>pop_back()</code></a></li><li><a href=#insertkv><code>insert(kv)</code></a></li><li><a href=#emplacek-v><code>emplace(k, v)</code></a></li><li><a href=#countk><code>count(k)</code></a></li><li><a href=#containsk><code>contains(k)</code></a></li><li><a href=#findk><code>find(k)</code></a></li><li><a href=#atk><code>at(k)</code></a></li><li><a href=#operatork><code>operator[](k)</code></a></li><li><a href=#erase><code>erase(...)</code></a></li><li><a href=#key_comp><code>key_comp()</code></a></li></ul></li><li><a href=#notes>Notes</a><ul><li><a href=#key-modification>Key Modification</a></li><li><a href=#order-preservation-details>Order Preservation Details</a></li></ul></li><li><a href=#related>Related</a></li></ul></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,197 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
parser.hpp
#
Defines functions for parsing files or strings and the exceptions they use.
While parse throws an exception on failure, try_parse returns error information.
parse
#
Parses the content of a given file and returns a toml::basic_value.
In case of failure, toml::syntax_error is thrown.
The type information of basic_value is provided by a template, and the TOML language version is specified by toml::spec.
parse(std::string filename, toml::spec)
#
namespace toml
{
template<typename TC = type_config>
basic_value<TC>
parse(std::string fname,
spec s = spec::default_version());
}
Parses the content of the given filename."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/parser/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="parser.hpp"><meta property="og:description" content="parser.hpp # Defines functions for parsing files or strings and the exceptions they use.
While parse throws an exception on failure, try_parse returns error information.
parse # Parses the content of a given file and returns a toml::basic_value.
In case of failure, toml::syntax_error is thrown.
The type information of basic_value is provided by a template, and the TOML language version is specified by toml::spec.
parse(std::string filename, toml::spec) # namespace toml { template<typename TC = type_config> basic_value<TC> parse(std::string fname, spec s = spec::default_version()); } Parses the content of the given filename."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>parser.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/parser/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/parser/ title=parser.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/parser/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/ class=active>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>parser.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#parserhpp>parser.hpp</a></li><li><a href=#parse><code>parse</code></a><ul><li><ul><li><a href=#parsestdstring-filename-tomlspec><code>parse(std::string filename, toml::spec)</code></a></li><li><a href=#parseconst-char-n-filename-tomlspec><code>parse(const char (&)[N] filename, toml::spec)</code></a></li><li><a href=#parsestdfilesystempath-tomlspec><code>parse(std::filesystem::path, toml::spec)</code></a></li><li><a href=#parsestdistream-stdstring-filename-tomlspec><code>parse(std::istream&, std::string filename, toml::spec)</code></a></li><li><a href=#parsefile-stdstring-filename-tomlspec><code>parse(FILE*, std::string filename, toml::spec)</code></a></li><li><a href=#parsestdvectorunsigned-char-stdstring-filename-tomlspec><code>parse(std::vector&lt;unsigned char>, std::string filename, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#parse_str><code>parse_str</code></a><ul><li><ul><li><a href=#parse_strstdstring-tomlspec><code>parse_str(std::string, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#try_parse><code>try_parse</code></a><ul><li><ul><li><a href=#try_parsestdstring-filename-tomlspec><code>try_parse(std::string filename, toml::spec)</code></a></li><li><a href=#try_parseconst-char-n-filename-tomlspec><code>try_parse(const char (&)[N] filename, toml::spec)</code></a></li><li><a href=#try_parsestdfilesystempath-tomlspec><code>try_parse(std::filesystem::path, toml::spec)</code></a></li><li><a href=#try_parsestdistream-stdstring-filename-tomlspec><code>try_parse(std::istream&, std::string filename, toml::spec)</code></a></li><li><a href=#try_parsefile-stdstring-filename-tomlspec><code>try_parse(FILE*, std::string filename, toml::spec)</code></a></li><li><a href=#try_parsestdvectorunsigned-char-stdstring-filename-tomlspec><code>try_parse(std::vector&lt;unsigned char>, std::string filename, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#try_parse_str><code>try_parse_str</code></a><ul><li><ul><li><a href=#try_parse_strstdstring-tomlspec><code>try_parse_str(std::string, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#syntax_error><code>syntax_error</code></a></li><li><a href=#file_io_error><code>file_io_error</code></a><ul><li><ul><li><a href=#has_errno><code>has_errno</code></a></li><li><a href=#get_errno><code>get_errno</code></a></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=parserhpp>parser.hpp
<a class=anchor href=#parserhpp>#</a></h1><p>Defines functions for parsing files or strings and the exceptions they use.</p><p>While <code>parse</code> throws an exception on failure, <code>try_parse</code> returns error information.</p><h1 id=parse><code>parse</code>
<a class=anchor href=#parse>#</a></h1><p>Parses the content of a given file and returns a <code>toml::basic_value</code>.</p><p>In case of failure, <code>toml::syntax_error</code> is thrown.</p><p>The type information of <code>basic_value</code> is provided by a <code>template</code>, and the TOML language version is specified by <code>toml::spec</code>.</p><h3 id=parsestdstring-filename-tomlspec><code>parse(std::string filename, toml::spec)</code>
<a class=anchor href=#parsestdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse(std<span style=color:#f92672>::</span>string fname,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Parses the content of the given filename.</p><p>If reading the file fails, <code>toml::file_io_error</code> is thrown.</p><p>If parsing fails, <code>toml::syntax_error</code> is thrown.</p><h3 id=parseconst-char-n-filename-tomlspec><code>parse(const char (&)[N] filename, toml::spec)</code>
<a class=anchor href=#parseconst-char-n-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config, std<span style=color:#f92672>::</span>size_t N<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span> (<span style=color:#f92672>&amp;</span>fname)[N],
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Parses the content of the given filename from a string literal.</p><p>If reading the file fails, <code>toml::file_io_error</code> is thrown.</p><p>If parsing fails, <code>toml::syntax_error</code> is thrown.</p><h3 id=parsestdfilesystempath-tomlspec><code>parse(std::filesystem::path, toml::spec)</code>
<a class=anchor href=#parsestdfilesystempath-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>filesystem<span style=color:#f92672>::</span>path<span style=color:#f92672>&amp;</span> fpath,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>This is defined only if <code>&lt;filesystem></code> is available.</p><p>Parses the content of the file at the given file path.</p><p>If reading the file fails, <code>toml::file_io_error</code> is thrown.</p><p>If parsing fails, <code>toml::syntax_error</code> is thrown.</p><h3 id=parsestdistream-stdstring-filename-tomlspec><code>parse(std::istream&, std::string filename, toml::spec)</code>
<a class=anchor href=#parsestdistream-stdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse(std<span style=color:#f92672>::</span>istream<span style=color:#f92672>&amp;</span> is,
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string fname <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;unknown file&#34;</span>,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Parses the content of the given <code>std::istream&</code>.</p><p>Open a stream in binary mode by passing <code>std::ios::binary</code> to avoid inconsistency between the file size and the number of characters due to automatic conversion of newline characters by the standard library.</p><p>The filename information is taken as the second argument. If the filename is not provided, it defaults to <code>"unknown file"</code>.</p><h3 id=parsefile-stdstring-filename-tomlspec><code>parse(FILE*, std::string filename, toml::spec)</code>
<a class=anchor href=#parsefile-stdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>parse(FILE<span style=color:#f92672>*</span> fp,
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string filename,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Parses the content of the file pointed to by <code>FILE*</code>.</p><p>Open a stream in binary mode by passing <code>"rb"</code> to avoid inconsistency between the file size and the number of characters due to automatic conversion of newline characters by the standard library.</p><p>If reading the file fails, <code>file_io_error</code> containing <code>errno</code> is thrown.</p><p>If parsing fails, <code>syntax_error</code> is thrown.</p><h3 id=parsestdvectorunsigned-char-stdstring-filename-tomlspec><code>parse(std::vector&lt;unsigned char>, std::string filename, toml::spec)</code>
<a class=anchor href=#parsestdvectorunsigned-char-stdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse(std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>unsigned</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>&gt;</span> content,
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string filename,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Parses the byte sequence as a TOML file.</p><p>If parsing fails, <code>toml::syntax_error</code> is thrown.</p><h1 id=parse_str><code>parse_str</code>
<a class=anchor href=#parse_str>#</a></h1><h3 id=parse_strstdstring-tomlspec><code>parse_str(std::string, toml::spec)</code>
<a class=anchor href=#parse_strstdstring-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse_str(std<span style=color:#f92672>::</span>string content,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version(),
</span></span><span style=display:flex><span> cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Parses a string as a TOML file.</p><p>In case of failure, <code>toml::syntax_error</code> is thrown.</p><p>The type information of <code>basic_value</code> is provided by a <code>template</code>, and the TOML language version is specified by <code>toml::spec</code>.</p><p>You generally don&rsquo;t need to manually set the third argument, <code>cxx::source_location</code>.
If <code>std::source_location</code>, <code>std::experimental::source_location</code>, or <code>__builtin_FILE</code> is available,
the location information where <code>parse_str</code> was called will be stored.</p><h1 id=try_parse><code>try_parse</code>
<a class=anchor href=#try_parse>#</a></h1><p>Parses the contents of the given file and returns a <code>toml::basic_value</code> if successful, or a <code>std::vector&lt;toml::error_info></code> if it fails.</p><p>The type information of <code>basic_value</code> is specified by <code>template</code>, and the version of the TOML language is specified by <code>toml::spec</code>.</p><blockquote class="book-hint warning"><p>Unlike <code>parse</code>, <code>try_parse</code> does not throw exceptions defined in toml11 such as <code>syntax_error</code>.
However, please note that exceptions thrown by the standard library will still propagate.</p><p>For instance, errors occurring internally within <code>std::ifstream</code> or memory exhaustion in <code>std::vector</code> will throw exceptions.</p></blockquote><h3 id=try_parsestdstring-filename-tomlspec><code>try_parse(std::string filename, toml::spec)</code>
<a class=anchor href=#try_parsestdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>try_parse(std<span style=color:#f92672>::</span>string fname,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Takes a file name and parses its content.</p><p>If parsing fails, a <code>result</code> holding the error type <code>std::vector&lt;error_info></code> is returned.</p><p>If successful, a <code>result</code> holding a <code>basic_value</code> is returned.</p><h3 id=try_parseconst-char-n-filename-tomlspec><code>try_parse(const char (&)[N] filename, toml::spec)</code>
<a class=anchor href=#try_parseconst-char-n-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config, std<span style=color:#f92672>::</span>size_t N<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>try_parse(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span> (<span style=color:#f92672>&amp;</span>fname)[N],
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Takes a string literal as a file name and parses its content.</p><p>If parsing fails, a <code>result</code> holding the error type <code>std::vector&lt;error_info></code> is returned.</p><p>If successful, a <code>result</code> holding a <code>basic_value</code> is returned.</p><h3 id=try_parsestdfilesystempath-tomlspec><code>try_parse(std::filesystem::path, toml::spec)</code>
<a class=anchor href=#try_parsestdfilesystempath-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>try_parse(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>filesystem<span style=color:#f92672>::</span>path<span style=color:#f92672>&amp;</span> fpath,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Takes a file path and parses its content.</p><p>If parsing fails, a <code>result</code> holding the error type <code>std::vector&lt;error_info></code> is returned.</p><p>If successful, a <code>result</code> holding a <code>basic_value</code> is returned.</p><h3 id=try_parsestdistream-stdstring-filename-tomlspec><code>try_parse(std::istream&, std::string filename, toml::spec)</code>
<a class=anchor href=#try_parsestdistream-stdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>try_parse(std<span style=color:#f92672>::</span>istream<span style=color:#f92672>&amp;</span> is,
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string fname <span style=color:#f92672>=</span> <span style=color:#e6db74>&#34;unknown file&#34;</span>,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Takes a <code>std::istream&</code> and parses its content.</p><p>Open a stream in binary mode by passing <code>std::ios::binary</code> to avoid inconsistency between the file size and the number of characters due to automatic conversion of newline characters by the standard library.</p><p>The file name information is taken as the second argument. If a file name is not provided, it defaults to <code>"unknown file"</code>.</p><p>If parsing fails, a <code>result</code> holding the error type <code>std::vector&lt;error_info></code> is returned.</p><p>If successful, a <code>result</code> holding a <code>basic_value</code> is returned.</p><h3 id=try_parsefile-stdstring-filename-tomlspec><code>try_parse(FILE*, std::string filename, toml::spec)</code>
<a class=anchor href=#try_parsefile-stdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>try_parse(FILE<span style=color:#f92672>*</span> fp,
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string filename,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Takes a <code>FILE*</code> and parses its content.</p><p>Open a stream in binary mode by passing <code>"rb"</code> to avoid inconsistency between the file size and the number of characters due to automatic conversion of newline characters by the standard library.</p><p>If parsing fails, a <code>result</code> holding the error type <code>std::vector&lt;error_info></code> is returned.</p><p>If successful, a <code>result</code> holding a <code>basic_value</code> is returned.</p><h3 id=try_parsestdvectorunsigned-char-stdstring-filename-tomlspec><code>try_parse(std::vector&lt;unsigned char>, std::string filename, toml::spec)</code>
<a class=anchor href=#try_parsestdvectorunsigned-char-stdstring-filename-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>try_parse(std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>unsigned</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>&gt;</span> content,
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string filename,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Takes a byte array and parses its content as a TOML file.</p><p>If parsing fails, a <code>result</code> holding the error type <code>std::vector&lt;error_info></code> is returned.</p><p>If successful, a <code>result</code> holding a <code>basic_value</code> is returned.</p><h1 id=try_parse_str><code>try_parse_str</code>
<a class=anchor href=#try_parse_str>#</a></h1><h3 id=try_parse_strstdstring-tomlspec><code>try_parse_str(std::string, toml::spec)</code>
<a class=anchor href=#try_parse_strstdstring-tomlspec>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC <span style=color:#f92672>=</span> type_config<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;</span>, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>try_parse_str(std<span style=color:#f92672>::</span>string content,
</span></span><span style=display:flex><span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version(),
</span></span><span style=display:flex><span> cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Parses a string as a TOML file, returning a <code>toml::basic_value</code> if successful, or a <code>std::vector&lt;toml::error_info></code> if it fails.</p><p>Unlike <code>parse_str</code>, it does not throw <code>syntax_error</code>, but instead returns error information as the failure type of the <code>result</code>.</p><p>If <code>std::source_location</code>, <code>std::experimental::source_location</code>, or <code>__builtin_FILE</code> is available, it will record the location information.</p><p>Typically, you do not need to manually set the third argument <code>cxx::source_location</code>. If any of <code>std::source_location</code>, <code>std::experimental::source_location</code>, or <code>__builtin_FILE</code> are available, the information of the location where <code>parse_str</code> was called will be saved as the location information.</p><blockquote class="book-hint warning"><p>Unlike <code>parse</code>, <code>try_parse</code> does not throw exceptions defined in toml11 such as <code>syntax_error</code>. However, please note that exceptions thrown by the standard library will still propagate.</p><p>For instance, errors occurring internally within <code>std::ifstream</code> or memory exhaustion in <code>std::vector</code> will throw exceptions.</p></blockquote><h1 id=syntax_error><code>syntax_error</code>
<a class=anchor href=#syntax_error>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>syntax_error</span> <span style=color:#66d9ef>final</span> <span style=color:#f92672>:</span> <span style=color:#66d9ef>public</span> <span style=color:#f92672>::</span>toml<span style=color:#f92672>::</span>exception
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>public</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span> syntax_error(std<span style=color:#f92672>::</span>string what_arg, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;</span> err);
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>syntax_error() <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>what</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>error_info<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> errors() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>An exception thrown when a syntax error is detected in TOML.</p><p>It is thrown by <code>parse</code> but not by <code>try_parse</code>.</p><h1 id=file_io_error><code>file_io_error</code>
<a class=anchor href=#file_io_error>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>file_io_error</span> <span style=color:#66d9ef>final</span> <span style=color:#f92672>:</span> <span style=color:#66d9ef>public</span> <span style=color:#f92672>::</span>toml<span style=color:#f92672>::</span>exception
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>public</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span> file_io_error(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> msg, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> fname);
</span></span><span style=display:flex><span> file_io_error(<span style=color:#66d9ef>int</span> errnum, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> msg, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> fname);
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>file_io_error() <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>what</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>has_errno</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>int</span> <span style=color:#a6e22e>get_errno</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>An exception thrown when reading the contents of a file fails.</p><p>When using <code>FILE*</code> to read a file, <code>errno</code> is set.</p><h3 id=has_errno><code>has_errno</code>
<a class=anchor href=#has_errno>#</a></h3><p>If <code>std::ifstream</code> fails, <code>errno</code> is not set.</p><p>In this case, <code>has_errno</code> returns <code>false</code>.</p><h3 id=get_errno><code>get_errno</code>
<a class=anchor href=#get_errno>#</a></h3><p>Particularly when passing a <code>FILE*</code>, retrieves the value of <code>errno</code>.</p><p>If <code>has_errno</code> is <code>false</code>, it returns <code>0</code>.</p><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/result/>result.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/value/>value.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#parserhpp>parser.hpp</a></li><li><a href=#parse><code>parse</code></a><ul><li><ul><li><a href=#parsestdstring-filename-tomlspec><code>parse(std::string filename, toml::spec)</code></a></li><li><a href=#parseconst-char-n-filename-tomlspec><code>parse(const char (&)[N] filename, toml::spec)</code></a></li><li><a href=#parsestdfilesystempath-tomlspec><code>parse(std::filesystem::path, toml::spec)</code></a></li><li><a href=#parsestdistream-stdstring-filename-tomlspec><code>parse(std::istream&, std::string filename, toml::spec)</code></a></li><li><a href=#parsefile-stdstring-filename-tomlspec><code>parse(FILE*, std::string filename, toml::spec)</code></a></li><li><a href=#parsestdvectorunsigned-char-stdstring-filename-tomlspec><code>parse(std::vector&lt;unsigned char>, std::string filename, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#parse_str><code>parse_str</code></a><ul><li><ul><li><a href=#parse_strstdstring-tomlspec><code>parse_str(std::string, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#try_parse><code>try_parse</code></a><ul><li><ul><li><a href=#try_parsestdstring-filename-tomlspec><code>try_parse(std::string filename, toml::spec)</code></a></li><li><a href=#try_parseconst-char-n-filename-tomlspec><code>try_parse(const char (&)[N] filename, toml::spec)</code></a></li><li><a href=#try_parsestdfilesystempath-tomlspec><code>try_parse(std::filesystem::path, toml::spec)</code></a></li><li><a href=#try_parsestdistream-stdstring-filename-tomlspec><code>try_parse(std::istream&, std::string filename, toml::spec)</code></a></li><li><a href=#try_parsefile-stdstring-filename-tomlspec><code>try_parse(FILE*, std::string filename, toml::spec)</code></a></li><li><a href=#try_parsestdvectorunsigned-char-stdstring-filename-tomlspec><code>try_parse(std::vector&lt;unsigned char>, std::string filename, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#try_parse_str><code>try_parse_str</code></a><ul><li><ul><li><a href=#try_parse_strstdstring-tomlspec><code>try_parse_str(std::string, toml::spec)</code></a></li></ul></li></ul></li><li><a href=#syntax_error><code>syntax_error</code></a></li><li><a href=#file_io_error><code>file_io_error</code></a><ul><li><ul><li><a href=#has_errno><code>has_errno</code></a></li><li><a href=#get_errno><code>get_errno</code></a></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,313 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
result.hpp
#
result.hpp defines the result type, which can hold either a success value or a failure value.
This is used as the return type for toml::try_parse, which does not throw exceptions.
success
#
A type that holds a success value.
namespace toml
{
template<typename T>
struct success
{
using value_type = T;
explicit success(value_type v);
~success() = default;
success(const success&) = default;
success(success&&) = default;
success& operator=(const success&) = default;
success& operator=(success&&) = default;
template<typename U>
explicit success(U&& v);
template<typename U>
explicit success(success<U> v);
value_type& get() noexcept;
value_type const& get() const noexcept;
};
template<typename T>
success<typename std::decay<T>::type> ok(T&& v);
template<std::size_t N>
success<std::string> ok(const char (&amp;literal)[N])
}
Member Types
#
using value_type = T;
The type of the success value."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/result/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="result.hpp"><meta property="og:description" content="result.hpp # result.hpp defines the result type, which can hold either a success value or a failure value.
This is used as the return type for toml::try_parse, which does not throw exceptions.
success # A type that holds a success value.
namespace toml { template<typename T> struct success { using value_type = T; explicit success(value_type v); ~success() = default; success(const success&) = default; success(success&&) = default; success& operator=(const success&) = default; success& operator=(success&&) = default; template<typename U> explicit success(U&& v); template<typename U> explicit success(success<U> v); value_type& get() noexcept; value_type const& get() const noexcept; }; template<typename T> success<typename std::decay<T>::type> ok(T&& v); template<std::size_t N> success<std::string> ok(const char (&amp;literal)[N]) } Member Types # using value_type = T; The type of the success value."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>result.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/result/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/result/ title=result.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/result/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/ class=active>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>result.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#resulthpp>result.hpp</a></li><li><a href=#success>success</a><ul><li><a href=#member-types>Member Types</a></li><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor>Constructor</a></li><li><a href=#get><code>get()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#okt><code>ok(T)</code></a></li></ul></li></ul></li><li><a href=#successreference_wrappert><code>success&lt;reference_wrapper&lt;T>></code></a><ul><li><a href=#member-types-1>Member Types</a><ul><li><a href=#get-1><code>get()</code></a></li></ul></li></ul></li><li><a href=#failure>failure</a><ul><li><a href=#member-types-2>Member Types</a></li><li><a href=#member-functions-1>Member Functions</a><ul><li><a href=#constructor-1>Constructor</a></li><li><a href=#get-2><code>get()</code></a></li></ul></li><li><a href=#non-member-functions-1>Non-Member Functions</a><ul><li><a href=#errt><code>err(T)</code></a></li></ul></li></ul></li><li><a href=#failurereference_wrappert><code>failure&lt;reference_wrapper&lt;T>></code></a><ul><li><a href=#member-types-3>Member Types</a><ul><li><a href=#get-3><code>get()</code></a></li></ul></li></ul></li><li><a href=#result>result</a><ul><li><a href=#member-types-4>Member Types</a><ul><li><a href=#success_type><code>success_type</code></a></li><li><a href=#failure_type><code>failure_type</code></a></li><li><a href=#value_type><code>value_type</code></a></li><li><a href=#error_type><code>error_type</code></a></li></ul></li><li><a href=#member-functions-2>Member Functions</a><ul><li><a href=#constructor-2>Constructor</a></li><li><a href=#copy-and-move-constructors>Copy and Move Constructors</a></li><li><a href=#operator><code>operator=</code></a></li><li><a href=#is_ok><code>is_ok()</code></a></li><li><a href=#is_err><code>is_err()</code></a></li><li><a href=#operator-bool><code>operator bool()</code></a></li><li><a href=#unwrap><code>unwrap()</code></a></li><li><a href=#unwrap_or><code>unwrap_or()</code></a></li><li><a href=#unwrap_err><code>unwrap_err()</code></a></li><li><a href=#as_ok><code>as_ok()</code></a></li><li><a href=#as_err><code>as_err()</code></a></li></ul></li></ul></li><li><a href=#bad_result_access>bad_result_access</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=resulthpp>result.hpp
<a class=anchor href=#resulthpp>#</a></h1><p><code>result.hpp</code> defines the <code>result</code> type, which can hold either a success value or a failure value.</p><p>This is used as the return type for <code>toml::try_parse</code>, which does not throw exceptions.</p><h1 id=success>success
<a class=anchor href=#success>#</a></h1><p>A type that holds a success value.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>success</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>success</span>(value_type v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>success() <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> success(<span style=color:#66d9ef>const</span> success<span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> success(success<span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> success<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(<span style=color:#66d9ef>const</span> success<span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> success<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(success<span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> success(U<span style=color:#f92672>&amp;&amp;</span> v);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> success(success<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>success<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> std<span style=color:#f92672>::</span>decay<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;::</span>type<span style=color:#f92672>&gt;</span> ok(T<span style=color:#f92672>&amp;&amp;</span> v);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>size_t N<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>success<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> ok(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span> (<span style=color:#f92672>&amp;</span>literal)[N])
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=member-types>Member Types
<a class=anchor href=#member-types>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span></code></pre></div><p>The type of the success value.</p><h2 id=member-functions>Member Functions
<a class=anchor href=#member-functions>#</a></h2><h3 id=constructor>Constructor
<a class=anchor href=#constructor>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>success</span>(value_type v);
</span></span></code></pre></div><p>Constructs with a <code>value_type</code> argument.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>explicit</span> success(U<span style=color:#f92672>&amp;&amp;</span> v);
</span></span></code></pre></div><p>Constructs with another type that can be converted to <code>value_type</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>explicit</span> success(success<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> v);
</span></span></code></pre></div><p>Constructs with another <code>success</code> type that can be converted to <code>value_type</code>.</p><h3 id=get><code>get()</code>
<a class=anchor href=#get>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Accesses the stored value.</p><h2 id=non-member-functions>Non-Member Functions
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=okt><code>ok(T)</code>
<a class=anchor href=#okt>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>success<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> std<span style=color:#f92672>::</span>decay<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;::</span>type<span style=color:#f92672>&gt;</span> ok(T<span style=color:#f92672>&amp;&amp;</span> v);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>size_t N<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>success<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> ok(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span> (<span style=color:#f92672>&amp;</span>literal)[N]);
</span></span></code></pre></div><p>Constructs and returns a <code>success</code> type from a success value.</p><p>Converts a string literal into <code>std::string</code>.</p><h1 id=successreference_wrappert><code>success&lt;reference_wrapper&lt;T>></code>
<a class=anchor href=#successreference_wrappert>#</a></h1><p>Specialization of <code>success</code> for when the success value is a reference.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>success</span><span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>reference_wrapper<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>success</span>(std<span style=color:#f92672>::</span>reference_wrapper<span style=color:#f92672>&lt;</span>value_type<span style=color:#f92672>&gt;</span> v) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=member-types-1>Member Types
<a class=anchor href=#member-types-1>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span></code></pre></div><p>The type of the success value. It is <code>T</code> from <code>std::reference_wrapper&lt;T></code>, not the reference itself.</p><h3 id=get-1><code>get()</code>
<a class=anchor href=#get-1>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Accesses the stored value.</p><h1 id=failure>failure
<a class=anchor href=#failure>#</a></h1><p>A type that holds a failure value.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>failure</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>failure</span>(value_type v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>failure() <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> failure(<span style=color:#66d9ef>const</span> failure<span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> failure(failure<span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> failure<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(<span style=color:#66d9ef>const</span> failure<span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> failure<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(failure<span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> failure(U<span style=color:#f92672>&amp;&amp;</span> v);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> failure(failure<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> v);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>failure<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> std<span style=color:#f92672>::</span>decay<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;::</span>type<span style=color:#f92672>&gt;</span> err(T<span style=color:#f92672>&amp;&amp;</span> v);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>size_t N<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>failure<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> err(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span> (<span style=color:#f92672>&amp;</span>literal)[N]);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=member-types-2>Member Types
<a class=anchor href=#member-types-2>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span></code></pre></div><p>The type of the failure value.</p><h2 id=member-functions-1>Member Functions
<a class=anchor href=#member-functions-1>#</a></h2><h3 id=constructor-1>Constructor
<a class=anchor href=#constructor-1>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>failure</span>(value_type v);
</span></span></code></pre></div><p>Constructs with a <code>value_type</code> argument.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>explicit</span> failure(U<span style=color:#f92672>&amp;&amp;</span> v);
</span></span></code></pre></div><p>Constructs with another type that can be converted to <code>value_type</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>explicit</span> failure(failure<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> v);
</span></span></code></pre></div><p>Constructs with another <code>failure</code> type that can be converted to <code>value_type</code>.</p><h3 id=get-2><code>get()</code>
<a class=anchor href=#get-2>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Accesses the stored value.</p><h2 id=non-member-functions-1>Non-Member Functions
<a class=anchor href=#non-member-functions-1>#</a></h2><h3 id=errt><code>err(T)</code>
<a class=anchor href=#errt>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>failure<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> std<span style=color:#f92672>::</span>decay<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;::</span>type<span style=color:#f92672>&gt;</span> err(T<span style=color:#f92672>&amp;&amp;</span> v);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>size_t N<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>failure<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> err(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span> (<span style=color:#f92672>&amp;</span>literal)[N]);
</span></span></code></pre></div><p>Constructs and returns a <code>failure</code> type from a failure value.</p><p>Converts a string literal into <code>std::string</code>.</p><h1 id=failurereference_wrappert><code>failure&lt;reference_wrapper&lt;T>></code>
<a class=anchor href=#failurereference_wrappert>#</a></h1><p>Specialization of <code>failure</code> for when the failure value is a reference.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>failure</span><span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>reference_wrapper<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;&gt;</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>failure</span>(std<span style=color:#f92672>::</span>reference_wrapper<span style=color:#f92672>&lt;</span>value_type<span style=color:#f92672>&gt;</span> v) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span> {<span style=color:#66d9ef>return</span> value.get();}
</span></span><span style=display:flex><span> value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> {<span style=color:#66d9ef>return</span> value.get();}
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=member-types-3>Member Types
<a class=anchor href=#member-types-3>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> T;
</span></span></code></pre></div><p>The type of the failure value. It is <code>T</code> from <code>std::reference_wrapper&lt;T></code>, not the reference itself.</p><h3 id=get-3><code>get()</code>
<a class=anchor href=#get-3>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> get() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Accesses the stored value.</p><h1 id=result>result
<a class=anchor href=#result>#</a></h1><p>A type that holds either a success value or a failure value.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#66d9ef>typename</span> E<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>result</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> success_type <span style=color:#f92672>=</span> success<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> failure_type <span style=color:#f92672>=</span> failure<span style=color:#f92672>&lt;</span>E<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> value_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> success_type<span style=color:#f92672>::</span>value_type;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> error_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> failure_type<span style=color:#f92672>::</span>value_type;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> result(success_type s);
</span></span><span style=display:flex><span> result(failure_type f);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> result(success<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> s);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> result(failure<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> f);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(success_type s);
</span></span><span style=display:flex><span> result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(failure_type f);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(success<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> s);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(failure<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> f);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>result() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> result(<span style=color:#66d9ef>const</span> result<span style=color:#f92672>&amp;</span> other);
</span></span><span style=display:flex><span> result(result<span style=color:#f92672>&amp;&amp;</span> other);
</span></span><span style=display:flex><span> result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(<span style=color:#66d9ef>const</span> result<span style=color:#f92672>&amp;</span> other);
</span></span><span style=display:flex><span> result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(result<span style=color:#f92672>&amp;&amp;</span> other);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U, <span style=color:#66d9ef>typename</span> F<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> result(result<span style=color:#f92672>&lt;</span>U, F<span style=color:#f92672>&gt;</span> other);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U, <span style=color:#66d9ef>typename</span> F<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(result<span style=color:#f92672>&lt;</span>U, F<span style=color:#f92672>&gt;</span> other);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_ok</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_err</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> <span style=color:#66d9ef>operator</span> <span style=color:#a6e22e>bool</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> value_type<span style=color:#f92672>&amp;</span> unwrap(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current());
</span></span><span style=display:flex><span> value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> unwrap(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current()) <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> value_type<span style=color:#f92672>&amp;</span> unwrap_or(value_type<span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> unwrap_or(value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> error_type<span style=color:#f92672>&amp;</span> unwrap_err(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current());
</span></span><span style=display:flex><span> error_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> unwrap_err(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current()) <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> value_type<span style=color:#f92672>&amp;</span> as_ok() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_ok() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> error_type<span style=color:#f92672>&amp;</span> as_err() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> error_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_err() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h2 id=member-types-4>Member Types
<a class=anchor href=#member-types-4>#</a></h2><h3 id=success_type><code>success_type</code>
<a class=anchor href=#success_type>#</a></h3><p><code>success&lt;T></code>.</p><h3 id=failure_type><code>failure_type</code>
<a class=anchor href=#failure_type>#</a></h3><p><code>failure&lt;E></code>.</p><h3 id=value_type><code>value_type</code>
<a class=anchor href=#value_type>#</a></h3><p>The type <code>T</code> of the success value, alias for <code>success_type::value_type</code>.</p><p>If <code>T</code> is <code>std::reference_wrapper&lt;U></code>, then it is <code>U</code>.</p><h3 id=error_type><code>error_type</code>
<a class=anchor href=#error_type>#</a></h3><p>The type <code>E</code> of the failure value, alias for <code>failure_type::value_type</code>.</p><p>If <code>E</code> is <code>std::reference_wrapper&lt;F></code>, then it is <code>F</code>.</p><h2 id=member-functions-2>Member Functions
<a class=anchor href=#member-functions-2>#</a></h2><h3 id=constructor-2>Constructor
<a class=anchor href=#constructor-2>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>result() <span style=color:#f92672>=</span> <span style=color:#66d9ef>delete</span>;
</span></span></code></pre></div><p>Cannot construct <code>result</code> type by default. Needs to be given either a success or failure type.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>result(success_type s);
</span></span><span style=display:flex><span>result(failure_type f);
</span></span></code></pre></div><p>Constructs with a <code>success_type</code> or <code>failure_type</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result(success<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> s);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result(failure<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> f);
</span></span></code></pre></div><p>Constructs with a <code>success&lt;U></code> or <code>failure&lt;U></code> that is convertible to <code>value_type</code> or <code>error_type</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U, <span style=color:#66d9ef>typename</span> F<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result(result<span style=color:#f92672>&lt;</span>U, F<span style=color:#f92672>&gt;</span> other);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U, <span style=color:#66d9ef>typename</span> F<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(result<span style=color:#f92672>&lt;</span>U, F<span style=color:#f92672>&gt;</span> other);
</span></span></code></pre></div><p>Constructs from or assigns to another <code>result</code> with convertible <code>success</code> or <code>failure</code> types.</p><h3 id=copy-and-move-constructors>Copy and Move Constructors
<a class=anchor href=#copy-and-move-constructors>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>result(<span style=color:#66d9ef>const</span> result<span style=color:#f92672>&amp;</span> other);
</span></span><span style=display:flex><span>result(result<span style=color:#f92672>&amp;&amp;</span> other);
</span></span></code></pre></div><p>Can be copy or move constructed.</p><h3 id=operator><code>operator=</code>
<a class=anchor href=#operator>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(<span style=color:#66d9ef>const</span> result<span style=color:#f92672>&amp;</span> other);
</span></span><span style=display:flex><span>result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(result<span style=color:#f92672>&amp;&amp;</span> other);
</span></span></code></pre></div><p>Can be copy or move assigned.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(success<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> s);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> U<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(failure<span style=color:#f92672>&lt;</span>U<span style=color:#f92672>&gt;</span> f);
</span></span></code></pre></div><p>Can be assigned from convertible <code>success</code> or <code>failure</code> types.</p><h3 id=is_ok><code>is_ok()</code>
<a class=anchor href=#is_ok>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_ok</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns <code>true</code> if it holds a success value, <code>false</code> otherwise.</p><h3 id=is_err><code>is_err()</code>
<a class=anchor href=#is_err>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_err</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns <code>true</code> if it holds a failure value, <code>false</code> otherwise.</p><h3 id=operator-bool><code>operator bool()</code>
<a class=anchor href=#operator-bool>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>explicit</span> <span style=color:#66d9ef>operator</span> <span style=color:#a6e22e>bool</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns <code>true</code> if it holds a success value, <code>false</code> otherwise.</p><h3 id=unwrap><code>unwrap()</code>
<a class=anchor href=#unwrap>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> unwrap(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current());
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> unwrap(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current()) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><p>Returns the stored success value.</p><p>Throws <code>toml::bad_result_access</code> if it holds a failure value.</p><p>If <code>std::source_location</code> or equivalent compiler extension is available, the file name and line number where <code>unwrap()</code> occurred are included in the <code>what()</code> string.</p><h3 id=unwrap_or><code>unwrap_or()</code>
<a class=anchor href=#unwrap_or>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> unwrap_or(value_type<span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> unwrap_or(value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> opt) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the stored success value if present, otherwise returns the provided default value.</p><h3 id=unwrap_err><code>unwrap_err()</code>
<a class=anchor href=#unwrap_err>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>error_type<span style=color:#f92672>&amp;</span> unwrap_err(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current());
</span></span><span style=display:flex><span>error_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> unwrap_err(cxx<span style=color:#f92672>::</span>source_location loc <span style=color:#f92672>=</span> cxx<span style=color:#f92672>::</span>source_location<span style=color:#f92672>::</span>current()) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><p>Returns the stored failure value.</p><p>Throws <code>toml::bad_result_access</code> if it holds a success value.</p><p>If <code>std::source_location</code> or equivalent compiler extension is available, the file name and line number where <code>unwrap_err()</code> occurred are included in the <code>what()</code> string.</p><h3 id=as_ok><code>as_ok()</code>
<a class=anchor href=#as_ok>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> as_ok() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_ok() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the success value without checking.</p><p>Behavior is undefined if it holds a failure value.</p><h3 id=as_err><code>as_err()</code>
<a class=anchor href=#as_err>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>error_type<span style=color:#f92672>&amp;</span> as_err() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>error_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_err() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the failure value without checking.</p><p>Behavior is undefined if it holds a success value.</p><h1 id=bad_result_access>bad_result_access
<a class=anchor href=#bad_result_access>#</a></h1><p>An exception thrown when <code>unwrap</code> or <code>unwrap_err</code> fails in a <code>result</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>bad_result_access</span> <span style=color:#f92672>:</span> <span style=color:#66d9ef>public</span> <span style=color:#f92672>::</span>toml<span style=color:#f92672>::</span>exception
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>public</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> bad_result_access(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> what_arg);
</span></span><span style=display:flex><span> <span style=color:#66d9ef>virtual</span> <span style=color:#f92672>~</span>bad_result_access() <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>virtual</span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>what</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>protected</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string what_;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>}
</span></span></code></pre></div></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#resulthpp>result.hpp</a></li><li><a href=#success>success</a><ul><li><a href=#member-types>Member Types</a></li><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor>Constructor</a></li><li><a href=#get><code>get()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#okt><code>ok(T)</code></a></li></ul></li></ul></li><li><a href=#successreference_wrappert><code>success&lt;reference_wrapper&lt;T>></code></a><ul><li><a href=#member-types-1>Member Types</a><ul><li><a href=#get-1><code>get()</code></a></li></ul></li></ul></li><li><a href=#failure>failure</a><ul><li><a href=#member-types-2>Member Types</a></li><li><a href=#member-functions-1>Member Functions</a><ul><li><a href=#constructor-1>Constructor</a></li><li><a href=#get-2><code>get()</code></a></li></ul></li><li><a href=#non-member-functions-1>Non-Member Functions</a><ul><li><a href=#errt><code>err(T)</code></a></li></ul></li></ul></li><li><a href=#failurereference_wrappert><code>failure&lt;reference_wrapper&lt;T>></code></a><ul><li><a href=#member-types-3>Member Types</a><ul><li><a href=#get-3><code>get()</code></a></li></ul></li></ul></li><li><a href=#result>result</a><ul><li><a href=#member-types-4>Member Types</a><ul><li><a href=#success_type><code>success_type</code></a></li><li><a href=#failure_type><code>failure_type</code></a></li><li><a href=#value_type><code>value_type</code></a></li><li><a href=#error_type><code>error_type</code></a></li></ul></li><li><a href=#member-functions-2>Member Functions</a><ul><li><a href=#constructor-2>Constructor</a></li><li><a href=#copy-and-move-constructors>Copy and Move Constructors</a></li><li><a href=#operator><code>operator=</code></a></li><li><a href=#is_ok><code>is_ok()</code></a></li><li><a href=#is_err><code>is_err()</code></a></li><li><a href=#operator-bool><code>operator bool()</code></a></li><li><a href=#unwrap><code>unwrap()</code></a></li><li><a href=#unwrap_or><code>unwrap_or()</code></a></li><li><a href=#unwrap_err><code>unwrap_err()</code></a></li><li><a href=#as_ok><code>as_ok()</code></a></li><li><a href=#as_err><code>as_err()</code></a></li></ul></li></ul></li><li><a href=#bad_result_access>bad_result_access</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,65 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
serializer.hpp
#
format
#
Serializes the data.
namespace toml
{
template<typename TC>
std::string format(const basic_value<TC>& v,
const spec s = spec::default_version());
template<typename TC>
std::string format(const typename basic_value<TC>::key_type& k,
const basic_value<TC>& v,
const spec s = spec::default_version());
template<typename TC>
std::string format(const std::vector<typename basic_value<TC>::key_type>& ks,
const basic_value<TC>& v,
const spec s = spec::default_version());
}
If there&rsquo;s a conflict between the format information and the spec, for example, when using v1.0.0 with table_format::multiline_oneline, the spec takes precedence."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/serializer/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="serializer.hpp"><meta property="og:description" content="serializer.hpp # format # Serializes the data.
namespace toml { template<typename TC> std::string format(const basic_value<TC>& v, const spec s = spec::default_version()); template<typename TC> std::string format(const typename basic_value<TC>::key_type& k, const basic_value<TC>& v, const spec s = spec::default_version()); template<typename TC> std::string format(const std::vector<typename basic_value<TC>::key_type>& ks, const basic_value<TC>& v, const spec s = spec::default_version()); } If theres a conflict between the format information and the spec, for example, when using v1.0.0 with table_format::multiline_oneline, the spec takes precedence."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>serializer.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/serializer/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/serializer/ title=serializer.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/serializer/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/ class=active>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>serializer.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#serializerhpp>serializer.hpp</a><ul><li><a href=#format><code>format</code></a><ul><li><a href=#formatv-spec><code>format(v, spec)</code></a></li><li><a href=#formatk-v-spec><code>format(k, v, spec)</code></a></li><li><a href=#formatk-v-spec-1><code>format([k,...], v, spec)</code></a></li></ul></li><li><a href=#serialization_error><code>serialization_error</code></a></li></ul></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=serializerhpp>serializer.hpp
<a class=anchor href=#serializerhpp>#</a></h1><h2 id=format><code>format</code>
<a class=anchor href=#format>#</a></h2><p>Serializes the data.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format(<span style=color:#66d9ef>const</span> <span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&amp;</span> k,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;::</span>key_type<span style=color:#f92672>&gt;&amp;</span> ks,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> spec s <span style=color:#f92672>=</span> spec<span style=color:#f92672>::</span>default_version());
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>If there&rsquo;s a conflict between the format information and the <code>spec</code>, for example, when using <code>v1.0.0</code> with <code>table_format::multiline_oneline</code>, the <code>spec</code> takes precedence.</p><h3 id=formatv-spec><code>format(v, spec)</code>
<a class=anchor href=#formatv-spec>#</a></h3><p>Formats a <code>toml::value</code> according to its format information and the provided <code>spec</code>.</p><p>If it&rsquo;s a <code>table_type</code>, it&rsquo;s formatted as if it were the root table. Otherwise, only the value is formatted.</p><h3 id=formatk-v-spec><code>format(k, v, spec)</code>
<a class=anchor href=#formatk-v-spec>#</a></h3><p>Formats a <code>toml::value</code> along with the given key.</p><p><code>v</code> is interpreted as being defined under that key.</p><h3 id=formatk-v-spec-1><code>format([k,...], v, spec)</code>
<a class=anchor href=#formatk-v-spec-1>#</a></h3><p><code>v</code> is interpreted as being defined under those keys.
If multiple keys are provided, it&rsquo;s interpreted as a recursively defined table.</p><h2 id=serialization_error><code>serialization_error</code>
<a class=anchor href=#serialization_error>#</a></h2><p>Reports errors that occurred during serialization.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>serialization_error</span> <span style=color:#66d9ef>final</span> <span style=color:#f92672>:</span> <span style=color:#66d9ef>public</span> <span style=color:#f92672>::</span>toml<span style=color:#f92672>::</span>exception
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>public</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> serialization_error(std<span style=color:#f92672>::</span>string what_arg, source_location loc);
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>serialization_error() <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>what</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span>;
</span></span><span style=display:flex><span> source_location <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> location() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>}
</span></span></code></pre></div></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#serializerhpp>serializer.hpp</a><ul><li><a href=#format><code>format</code></a><ul><li><a href=#formatv-spec><code>format(v, spec)</code></a></li><li><a href=#formatk-v-spec><code>format(k, v, spec)</code></a></li><li><a href=#formatk-v-spec-1><code>format([k,...], v, spec)</code></a></li></ul></li><li><a href=#serialization_error><code>serialization_error</code></a></li></ul></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,162 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
source_location.hpp
#
source_location.hpp defines a class representing a specific area within a TOML file.
This class is used to represent problematic areas in error messages.
toml::source_location
#
source_location is a class representing a specific area within a TOML file.
namespace toml
{
struct source_location
{
public:
explicit source_location(/* implementation-defined */);
~source_location() = default;
source_location(source_location const&) = default;
source_location(source_location &&) = default;
source_location& operator=(source_location const&) = default;
source_location& operator=(source_location &&) = default;
bool is_ok() const noexcept;
std::size_t length() const noexcept;
std::size_t first_line_number() const noexcept;
std::size_t first_column_number() const noexcept;
std::size_t last_line_number() const noexcept;
std::size_t last_column_number() const noexcept;
std::string const& file_name() const noexcept;
std::size_t num_lines() const noexcept;
std::string const& first_line() const;
std::string const& last_line() const;
std::vector<std::string> const& lines() const noexcept;
};
template<typename ... Ts>
std::string format_location(const source_location& loc, const std::string& msg, const Ts& ... locs_and_msgs);
} //toml
Member Functions
#
Constructor
#
explicit source_location(/* implementation-defined */);
toml::source_location can only be constructed via toml::parse or the _toml literal."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/source_location/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="source_location.hpp"><meta property="og:description" content="source_location.hpp # source_location.hpp defines a class representing a specific area within a TOML file.
This class is used to represent problematic areas in error messages.
toml::source_location # source_location is a class representing a specific area within a TOML file.
namespace toml { struct source_location { public: explicit source_location(/* implementation-defined */); ~source_location() = default; source_location(source_location const&) = default; source_location(source_location &&) = default; source_location& operator=(source_location const&) = default; source_location& operator=(source_location &&) = default; bool is_ok() const noexcept; std::size_t length() const noexcept; std::size_t first_line_number() const noexcept; std::size_t first_column_number() const noexcept; std::size_t last_line_number() const noexcept; std::size_t last_column_number() const noexcept; std::string const& file_name() const noexcept; std::size_t num_lines() const noexcept; std::string const& first_line() const; std::string const& last_line() const; std::vector<std::string> const& lines() const noexcept; }; template<typename ... Ts> std::string format_location(const source_location& loc, const std::string& msg, const Ts& ... locs_and_msgs); } //toml Member Functions # Constructor # explicit source_location(/* implementation-defined */); toml::source_location can only be constructed via toml::parse or the _toml literal."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>source_location.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/source_location/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/source_location/ title=source_location.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/source_location/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/ class=active>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>source_location.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#source_locationhpp>source_location.hpp</a></li><li><a href=#tomlsource_location><code>toml::source_location</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor>Constructor</a></li><li><a href=#is_ok><code>is_ok()</code></a></li><li><a href=#length><code>length()</code></a></li><li><a href=#first_line_number><code>first_line_number()</code></a></li><li><a href=#first_column_number><code>first_column_number()</code></a></li><li><a href=#last_line_number><code>last_line_number()</code></a></li><li><a href=#last_column_number><code>last_column_number()</code></a></li><li><a href=#file_name><code>file_name()</code></a></li><li><a href=#num_lines><code>num_lines()</code></a></li><li><a href=#first_line><code>first_line()</code></a></li><li><a href=#last_line><code>last_line()</code></a></li><li><a href=#lines><code>lines()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#format_location><code>format_location</code></a></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=source_locationhpp>source_location.hpp
<a class=anchor href=#source_locationhpp>#</a></h1><p><code>source_location.hpp</code> defines a class representing a specific area within a TOML file.</p><p>This class is used to represent problematic areas in error messages.</p><h1 id=tomlsource_location><code>toml::source_location</code>
<a class=anchor href=#tomlsource_location>#</a></h1><p><code>source_location</code> is a class representing a specific area within a TOML file.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>source_location</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>public</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>explicit</span> source_location(<span style=color:#75715e>/* implementation-defined */</span>);
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>source_location() <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> source_location(source_location <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> source_location(source_location <span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> source_location<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(source_location <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span> source_location<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(source_location <span style=color:#f92672>&amp;&amp;</span>) <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_ok</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>size_t length() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>size_t first_line_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>size_t first_column_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>size_t last_line_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>size_t last_column_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> file_name() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>size_t num_lines() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> first_line() <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> last_line() <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> lines() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_location(<span style=color:#66d9ef>const</span> source_location<span style=color:#f92672>&amp;</span> loc, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> msg, <span style=color:#66d9ef>const</span> Ts<span style=color:#f92672>&amp;</span> ... locs_and_msgs);
</span></span><span style=display:flex><span>} <span style=color:#75715e>//toml
</span></span></span></code></pre></div><h2 id=member-functions>Member Functions
<a class=anchor href=#member-functions>#</a></h2><h3 id=constructor>Constructor
<a class=anchor href=#constructor>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>source_location</span>(<span style=color:#75715e>/* implementation-defined */</span>);
</span></span></code></pre></div><p><code>toml::source_location</code> can only be constructed via <code>toml::parse</code> or the <code>_toml</code> literal.</p><h3 id=is_ok><code>is_ok()</code>
<a class=anchor href=#is_ok>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_ok</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns <code>true</code> if the <code>source_location</code> holds a valid value, <code>false</code> otherwise.</p><p>The result of <code>location()</code> from <code>toml::value</code> constructed outside of <code>toml::parse</code> or <code>_toml</code> literals returns <code>false</code> for <code>is_ok</code> as it points to nothing.</p><h3 id=length><code>length()</code>
<a class=anchor href=#length>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t length() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the length of the area pointed to by the <code>source_location</code>.</p><p>Returns <code>0</code> if it does not hold a valid value.</p><h3 id=first_line_number><code>first_line_number()</code>
<a class=anchor href=#first_line_number>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t first_line_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the line number of the first line of the area pointed to by the <code>source_location</code>.</p><p>Returns <code>1</code> if it does not hold a valid value.</p><h3 id=first_column_number><code>first_column_number()</code>
<a class=anchor href=#first_column_number>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t first_column_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the column number of the first column of the area pointed to by the <code>source_location</code>.</p><p>Returns <code>1</code> if it does not hold a valid value.</p><h3 id=last_line_number><code>last_line_number()</code>
<a class=anchor href=#last_line_number>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t last_line_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the line number of the last line of the area pointed to by the <code>source_location</code>.</p><p>Returns <code>1</code> if it does not hold a valid value.</p><h3 id=last_column_number><code>last_column_number()</code>
<a class=anchor href=#last_column_number>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t last_column_number() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the column number of the last column of the area pointed to by the <code>source_location</code>.</p><p>Returns <code>1</code> if it does not hold a valid value.</p><h3 id=file_name><code>file_name()</code>
<a class=anchor href=#file_name>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> file_name() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the file name containing the area pointed to by the <code>source_location</code>.</p><p>Returns <code>"unknown file"</code> if it does not hold a valid value.</p><h3 id=num_lines><code>num_lines()</code>
<a class=anchor href=#num_lines>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t num_lines() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns the number of lines in the area pointed to by the <code>source_location</code>.</p><p>Returns <code>0</code> if it does not hold a valid value.</p><h3 id=first_line><code>first_line()</code>
<a class=anchor href=#first_line>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> first_line() <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><p>Returns the first line of the area pointed to by the <code>source_location</code>.</p><p>Throws <code>std::out_of_range</code> if it does not hold a valid value.</p><h3 id=last_line><code>last_line()</code>
<a class=anchor href=#last_line>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> last_line() <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><p>Returns the last line of the area pointed to by the <code>source_location</code>.</p><p>Throws <code>std::out_of_range</code> if it does not hold a valid value.</p><h3 id=lines><code>lines()</code>
<a class=anchor href=#lines>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> lines() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Returns all lines in the area pointed to by the <code>source_location</code>.</p><p>Returns a reference to an empty <code>std::vector</code> if it does not hold a valid value.</p><h2 id=non-member-functions>Non-Member Functions
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=format_location><code>format_location</code>
<a class=anchor href=#format_location>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_location(<span style=color:#66d9ef>const</span> source_location<span style=color:#f92672>&amp;</span> loc, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> msg,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> Ts<span style=color:#f92672>&amp;</span> ... locs_and_msgs);
</span></span></code></pre></div><p>Formats the specified <code>source_location</code> and its associated message as follows:</p><pre tabindex=0><code> -&gt; {filename.toml}
|
1 | a = 42
| ^-- {message}
</code></pre><p>If colorization is enabled, ANSI escape sequences will be added for coloring.</p><p>When multiple <code>locs_and_msgs</code> are provided, they must be in the order of <code>const source_location&</code> followed by <code>const std::string&</code>, and the next pair in the same order, and so on.</p><h4 id=example-multiple-source_location-and-stdstring>Example: Multiple <code>source_location</code> and <code>std::string</code>
<a class=anchor href=#example-multiple-source_location-and-stdstring>#</a></h4><p>When multiple <code>source_location</code> and <code>std::string</code> pairs are provided, they are formatted as follows:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>source_location<span style=color:#f92672>&amp;</span> loc0;
</span></span><span style=display:flex><span>source_location<span style=color:#f92672>&amp;</span> loc1;
</span></span><span style=display:flex><span>source_location<span style=color:#f92672>&amp;</span> loc2;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string msg0;
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string msg1;
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string msg2;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>format_location(loc0, msg0,
</span></span><span style=display:flex><span> loc1, msg1,
</span></span><span style=display:flex><span> loc2, msg2);
</span></span></code></pre></div><pre tabindex=0><code> -&gt; {filename0.toml}
|
1 | a = 42
| ^-- {message0}
|
-&gt; {filename1.toml}
|
2 | b = 3.14
| ^-- {message1}
|
-&gt; {filename2.toml}
|
3 | c = &#34;foo&#34;
| ^-- {message2}
</code></pre><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/value/>value.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#source_locationhpp>source_location.hpp</a></li><li><a href=#tomlsource_location><code>toml::source_location</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor>Constructor</a></li><li><a href=#is_ok><code>is_ok()</code></a></li><li><a href=#length><code>length()</code></a></li><li><a href=#first_line_number><code>first_line_number()</code></a></li><li><a href=#first_column_number><code>first_column_number()</code></a></li><li><a href=#last_line_number><code>last_line_number()</code></a></li><li><a href=#last_column_number><code>last_column_number()</code></a></li><li><a href=#file_name><code>file_name()</code></a></li><li><a href=#num_lines><code>num_lines()</code></a></li><li><a href=#first_line><code>first_line()</code></a></li><li><a href=#last_line><code>last_line()</code></a></li><li><a href=#lines><code>lines()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#format_location><code>format_location</code></a></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,164 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
spec.hpp
#
spec.hpp defines classes for specifying the version of TOML.
toml::semantic_version
#
semantic_version is a class that stores version information.
namespace toml
{
struct semantic_version
{
constexpr semantic_version(std::uint32_t mjr, std::uint32_t mnr, std::uint32_t p) noexcept;
std::uint32_t major;
std::uint32_t minor;
std::uint32_t patch;
};
constexpr semantic_version
make_semver(std::uint32_t major, std::uint32_t minor, std::uint32_t patch) noexcept;
constexpr bool operator==(const semantic_version&, const semantic_version&) noexcept;
constexpr bool operator!=(const semantic_version&, const semantic_version&) noexcept;
constexpr bool operator< (const semantic_version&, const semantic_version&) noexcept;
constexpr bool operator<=(const semantic_version&, const semantic_version&) noexcept;
constexpr bool operator> (const semantic_version&, const semantic_version&) noexcept;
constexpr bool operator>=(const semantic_version&, const semantic_version&) noexcept;
std::ostream& operator<<(std::ostream& os, const semantic_version& ver);
} //toml
Member Functions
#
Constructor
#
constexpr semantic_version(std::uint32_t mjr, std::uint32_t mnr, std::uint32_t p) noexcept;
Constructs a semantic_version instance with the specified major, minor, and patch version numbers."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/spec/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="spec.hpp"><meta property="og:description" content="spec.hpp # spec.hpp defines classes for specifying the version of TOML.
toml::semantic_version # semantic_version is a class that stores version information.
namespace toml { struct semantic_version { constexpr semantic_version(std::uint32_t mjr, std::uint32_t mnr, std::uint32_t p) noexcept; std::uint32_t major; std::uint32_t minor; std::uint32_t patch; }; constexpr semantic_version make_semver(std::uint32_t major, std::uint32_t minor, std::uint32_t patch) noexcept; constexpr bool operator==(const semantic_version&, const semantic_version&) noexcept; constexpr bool operator!=(const semantic_version&, const semantic_version&) noexcept; constexpr bool operator< (const semantic_version&, const semantic_version&) noexcept; constexpr bool operator<=(const semantic_version&, const semantic_version&) noexcept; constexpr bool operator> (const semantic_version&, const semantic_version&) noexcept; constexpr bool operator>=(const semantic_version&, const semantic_version&) noexcept; std::ostream& operator<<(std::ostream& os, const semantic_version& ver); } //toml Member Functions # Constructor # constexpr semantic_version(std::uint32_t mjr, std::uint32_t mnr, std::uint32_t p) noexcept; Constructs a semantic_version instance with the specified major, minor, and patch version numbers."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>spec.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/spec/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/spec/ title=spec.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/spec/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/ class=active>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>spec.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#spechpp>spec.hpp</a></li><li><a href=#tomlsemantic_version><code>toml::semantic_version</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor>Constructor</a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#comparison-operators>Comparison Operators</a></li><li><a href=#stream-operator>Stream Operator</a></li><li><a href=#to_string><code>to_string</code></a></li></ul></li></ul></li><li><a href=#tomlspec><code>toml::spec</code></a><ul><li><a href=#member-functions-1>Member Functions</a><ul><li><a href=#constructor-1>Constructor</a></li><li><a href=#default_version><code>default_version()</code></a></li><li><a href=#vmajor-minor-patch><code>v(major, minor, patch)</code></a></li></ul></li><li><a href=#member-variables>Member Variables</a><ul><li><a href=#example>Example</a></li><li><a href=#v1_1_0_allow_control_characters_in_comments><code>v1_1_0_allow_control_characters_in_comments</code></a></li><li><a href=#v1_1_0_allow_newlines_in_inline_tables><code>v1_1_0_allow_newlines_in_inline_tables</code></a></li><li><a href=#v1_1_0_allow_trailing_comma_in_inline_tables><code>v1_1_0_allow_trailing_comma_in_inline_tables</code></a></li><li><a href=#v1_1_0_add_escape_sequence_e><code>v1_1_0_add_escape_sequence_e</code></a></li><li><a href=#v1_1_0_add_escape_sequence_x><code>v1_1_0_add_escape_sequence_x</code></a></li><li><a href=#v1_1_0_make_seconds_optional><code>v1_1_0_make_seconds_optional</code></a></li><li><a href=#ext_hex_float><code>ext_hex_float</code></a></li><li><a href=#ext_num_suffix><code>ext_num_suffix</code></a></li><li><a href=#ext_null_value><code>ext_null_value</code></a></li></ul></li></ul></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=spechpp>spec.hpp
<a class=anchor href=#spechpp>#</a></h1><p><code>spec.hpp</code> defines classes for specifying the version of TOML.</p><h1 id=tomlsemantic_version><code>toml::semantic_version</code>
<a class=anchor href=#tomlsemantic_version>#</a></h1><p><code>semantic_version</code> is a class that stores version information.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>semantic_version</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>constexpr</span> <span style=color:#a6e22e>semantic_version</span>(std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mjr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mnr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> p) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> major;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> minor;
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> patch;
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> semantic_version
</span></span><span style=display:flex><span><span style=color:#a6e22e>make_semver</span>(std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> major, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> minor, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> patch) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>==</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>!=</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;</span> (<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;=</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;</span> (<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;=</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;&lt;</span>(std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> os, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span> ver);
</span></span><span style=display:flex><span>} <span style=color:#75715e>//toml
</span></span></span></code></pre></div><h2 id=member-functions>Member Functions
<a class=anchor href=#member-functions>#</a></h2><h3 id=constructor>Constructor
<a class=anchor href=#constructor>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#a6e22e>semantic_version</span>(std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mjr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mnr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> p) <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Constructs a <code>semantic_version</code> instance with the specified <code>major</code>, <code>minor</code>, and <code>patch</code> version numbers.</p><h2 id=non-member-functions>Non-Member Functions
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=comparison-operators>Comparison Operators
<a class=anchor href=#comparison-operators>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>==</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>!=</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;</span> (<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;=</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;</span> (<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;=</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Compares two <code>semantic_version</code> instances according to semantic versioning rules.</p><h3 id=stream-operator>Stream Operator
<a class=anchor href=#stream-operator>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;&lt;</span>(std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> os, <span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span> ver);
</span></span></code></pre></div><p>Outputs the version in the format <code>{major}.{minor}.{patch}</code>.</p><h3 id=to_string><code>to_string</code>
<a class=anchor href=#to_string>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>string to_string(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span> ver);
</span></span></code></pre></div><p>Converts the version to a string in the format <code>{major}.{minor}.{patch}</code>.</p><h1 id=tomlspec><code>toml::spec</code>
<a class=anchor href=#tomlspec>#</a></h1><p><code>spec</code> is a class that stores TOML version information.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>spec</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>static</span> spec <span style=color:#a6e22e>default_version</span>() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>static</span> spec <span style=color:#a6e22e>v</span>(std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mjr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mnr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> p) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>spec</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span> semver) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> semantic_version version; <span style=color:#75715e>// toml version
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span> <span style=color:#75715e>// diff from v1.0.0 -&gt; v1.1.0
</span></span></span><span style=display:flex><span><span style=color:#75715e></span> <span style=color:#66d9ef>bool</span> v1_1_0_allow_control_characters_in_comments;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> v1_1_0_allow_newlines_in_inline_tables;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> v1_1_0_allow_trailing_comma_in_inline_tables;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> v1_1_0_allow_non_english_in_bare_keys;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> v1_1_0_add_escape_sequence_e;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> v1_1_0_add_escape_sequence_x;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>bool</span> v1_1_0_make_seconds_optional;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#75715e>// library extensions
</span></span></span><span style=display:flex><span><span style=color:#75715e></span> <span style=color:#66d9ef>bool</span> ext_hex_float; <span style=color:#75715e>// allow hex float
</span></span></span><span style=display:flex><span><span style=color:#75715e></span> <span style=color:#66d9ef>bool</span> ext_num_suffix; <span style=color:#75715e>// allow number suffix
</span></span></span><span style=display:flex><span><span style=color:#75715e></span> <span style=color:#66d9ef>bool</span> ext_null_value; <span style=color:#75715e>// allow null value
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>};
</span></span></code></pre></div><h2 id=member-functions-1>Member Functions
<a class=anchor href=#member-functions-1>#</a></h2><h3 id=constructor-1>Constructor
<a class=anchor href=#constructor-1>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>explicit</span> <span style=color:#a6e22e>spec</span>(<span style=color:#66d9ef>const</span> semantic_version<span style=color:#f92672>&amp;</span> semver) <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Constructs a <code>spec</code> with the specified TOML version.</p><p>Supports TOML v1.0.0 and TOML v1.1.0.</p><h3 id=default_version><code>default_version()</code>
<a class=anchor href=#default_version>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>static</span> spec <span style=color:#a6e22e>default_version</span>() <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Constructs a <code>spec</code> with the default version.</p><p>Used as the default value for <code>toml::parse</code> and <code>toml::format</code>.</p><p>In toml11 v4.4.0, the value is v1.0.0.</p><h3 id=vmajor-minor-patch><code>v(major, minor, patch)</code>
<a class=anchor href=#vmajor-minor-patch>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>constexpr</span> <span style=color:#66d9ef>static</span> spec <span style=color:#a6e22e>v</span>(std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mjr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> mnr, std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint32_t</span> p) <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><p>Constructs a <code>spec</code> with the specified version.</p><h2 id=member-variables>Member Variables
<a class=anchor href=#member-variables>#</a></h2><p>Each flag is automatically set to <code>true</code> when the specified version includes the corresponding feature.</p><p>You can modify these flags to change the behavior of <code>toml::parse</code> and <code>toml::format</code>.</p><blockquote class="book-hint warning"><p>Some features of TOML v1.1.0 are still under fairly lengthy discussion and may still be reverted.</p><p>If they are indeed reverted, toml11 will remove those features in a minor version upgrade or move them to a corresponding later version.</p><p>As such, any features related to future versions should be considered unstable.</p></blockquote><h3 id=example>Example
<a class=anchor href=#example>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>auto</span> spec <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>spec<span style=color:#f92672>::</span>v(<span style=color:#ae81ff>1</span>, <span style=color:#ae81ff>0</span>, <span style=color:#ae81ff>0</span>);
</span></span><span style=display:flex><span><span style=color:#75715e>// Allow newlines in inline tables in addition to v1.0.0 features.
</span></span></span><span style=display:flex><span><span style=color:#75715e>// Other v1.1.0 features are not enabled.
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>spec.v1_1_0_allow_newlines_in_inline_tables <span style=color:#f92672>=</span> true;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>auto</span> input <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>parse(<span style=color:#e6db74>&#34;input_file.toml&#34;</span>, spec);
</span></span></code></pre></div><h3 id=v1_1_0_allow_control_characters_in_comments><code>v1_1_0_allow_control_characters_in_comments</code>
<a class=anchor href=#v1_1_0_allow_control_characters_in_comments>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> v1_1_0_allow_control_characters_in_comments;
</span></span></code></pre></div><p>Allows most control characters in comments.</p><p>Added in TOML v1.1.0.</p><h3 id=v1_1_0_allow_newlines_in_inline_tables><code>v1_1_0_allow_newlines_in_inline_tables</code>
<a class=anchor href=#v1_1_0_allow_newlines_in_inline_tables>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> v1_1_0_allow_newlines_in_inline_tables;
</span></span></code></pre></div><p>Allows newlines in inline tables.</p><p>Added in TOML v1.1.0.</p><h3 id=v1_1_0_allow_trailing_comma_in_inline_tables><code>v1_1_0_allow_trailing_comma_in_inline_tables</code>
<a class=anchor href=#v1_1_0_allow_trailing_comma_in_inline_tables>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> v1_1_0_allow_trailing_comma_in_inline_tables;
</span></span></code></pre></div><p>Allows trailing commas in inline tables.</p><p>Added in TOML v1.1.0.</p><h3 id=v1_1_0_add_escape_sequence_e><code>v1_1_0_add_escape_sequence_e</code>
<a class=anchor href=#v1_1_0_add_escape_sequence_e>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> v1_1_0_add_escape_sequence_e;
</span></span></code></pre></div><p>Allows <code>\e</code> to represent the ESC character.</p><p>Added in TOML v1.1.0.</p><h3 id=v1_1_0_add_escape_sequence_x><code>v1_1_0_add_escape_sequence_x</code>
<a class=anchor href=#v1_1_0_add_escape_sequence_x>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> v1_1_0_add_escape_sequence_x;
</span></span></code></pre></div><p>Allows <code>\xHH</code> to represent a single byte character.</p><p>Added in TOML v1.1.0.</p><h3 id=v1_1_0_make_seconds_optional><code>v1_1_0_make_seconds_optional</code>
<a class=anchor href=#v1_1_0_make_seconds_optional>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> v1_1_0_make_seconds_optional;
</span></span></code></pre></div><p>Makes the seconds component in time optional.</p><p>Unspecified seconds default to <code>0</code>.</p><p>Added in TOML v1.1.0.</p><h3 id=ext_hex_float><code>ext_hex_float</code>
<a class=anchor href=#ext_hex_float>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> ext_hex_float;
</span></span></code></pre></div><p>This is a language extension specific to toml11.</p><p>It is initialized to <code>false</code> regardless of the specified version.
You must explicitly set it to <code>true</code> if you want to use it.</p><p>Allows hexadecimal representation of floating-point numbers.</p><p>The hexadecimal representation conforms to the <code>printf</code> format specifier <code>%a/%A</code>.</p><pre tabindex=0><code>hexf = 0xC0FFEEp-10
</code></pre><p><code>toml::format</code> will format using hexadecimal notation only if the passed <code>toml::spec</code> has <code>ext_hex_float</code> set to <code>true</code>.
If the format specifier indicates <code>hex</code> but the <code>toml::spec</code> passed to <code>toml::format</code> has <code>ext_hex_float</code> set to <code>false</code>, the hexadecimal specification is ignored, and the number is output in decimal notation with maximum precision.</p><h3 id=ext_num_suffix><code>ext_num_suffix</code>
<a class=anchor href=#ext_num_suffix>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> ext_num_suffix;
</span></span></code></pre></div><p>This is a language extension specific to toml11.</p><p>It is initialized to <code>false</code> regardless of the specified version.
You must explicitly set it to <code>true</code> if you want to use it.</p><p>Allows the addition of suffixes to decimal integers and floating-point numbers. This does not apply to hexadecimal, octal, or binary notations.</p><p>There must be an <code>_</code> separator between the number and the suffix.</p><p>The suffix cannot start with a digit to avoid confusion with the numeric part.</p><pre tabindex=0><code>distance = 10_m # valid
distance = 10_2m # invalid
distance = 10_2_m # valid
</code></pre><p>The suffix is stored in the format information as <code>std::string suffix</code>.
The <code>_</code> separating the number from the suffix is not included in the <code>suffix</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>toml<span style=color:#f92672>::</span>value distance <span style=color:#f92672>=</span> toml<span style=color:#f92672>::</span>find(input, <span style=color:#e6db74>&#34;distance&#34;</span>);
</span></span><span style=display:flex><span>assert(distance.as_integer_fmt().suffix <span style=color:#f92672>==</span> std<span style=color:#f92672>::</span>string(<span style=color:#e6db74>&#34;m&#34;</span>));
</span></span></code></pre></div><p><code>toml::format</code> will format the value with the suffix only if the passed <code>toml::spec</code> has <code>ext_num_suffix</code> set to <code>true</code>.</p><p>The <code>suffix</code> follows the grammar defined as:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-abnf data-lang=abnf><span style=display:flex><span><span style=color:#a6e22e>non-digit-graph</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>ALPHA</span> <span style=color:#f92672>/</span> <span style=color:#a6e22e>non-ascii</span>
</span></span><span style=display:flex><span><span style=color:#a6e22e>graph</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>ALPHA</span> <span style=color:#f92672>/</span> <span style=color:#66d9ef>DIGIT</span> <span style=color:#f92672>/</span> <span style=color:#a6e22e>non-ascii</span>
</span></span><span style=display:flex><span><span style=color:#a6e22e>suffix</span> <span style=color:#f92672>=</span> _ <span style=color:#a6e22e>non-digit-graph</span> <span style=color:#f92672>*</span>( <span style=color:#a6e22e>graph</span> <span style=color:#f92672>/</span> ( _ <span style=color:#a6e22e>graph</span> ) )
</span></span></code></pre></div><h3 id=ext_null_value><code>ext_null_value</code>
<a class=anchor href=#ext_null_value>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> ext_null_value;
</span></span></code></pre></div><p>This is a language extension specific to toml11.</p><p>Allows the use of <code>null</code> as a value.</p><p>A <code>toml::value</code> specified as <code>null</code> will have no value, and <code>is_empty()</code> will return <code>true</code>.</p><p><code>toml::format</code> will format it as <code>null</code> only if the passed <code>toml::spec</code> has <code>ext_null_value</code> set to <code>true</code>.
Otherwise, <code>toml::format</code> will terminate with an error.</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#spechpp>spec.hpp</a></li><li><a href=#tomlsemantic_version><code>toml::semantic_version</code></a><ul><li><a href=#member-functions>Member Functions</a><ul><li><a href=#constructor>Constructor</a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#comparison-operators>Comparison Operators</a></li><li><a href=#stream-operator>Stream Operator</a></li><li><a href=#to_string><code>to_string</code></a></li></ul></li></ul></li><li><a href=#tomlspec><code>toml::spec</code></a><ul><li><a href=#member-functions-1>Member Functions</a><ul><li><a href=#constructor-1>Constructor</a></li><li><a href=#default_version><code>default_version()</code></a></li><li><a href=#vmajor-minor-patch><code>v(major, minor, patch)</code></a></li></ul></li><li><a href=#member-variables>Member Variables</a><ul><li><a href=#example>Example</a></li><li><a href=#v1_1_0_allow_control_characters_in_comments><code>v1_1_0_allow_control_characters_in_comments</code></a></li><li><a href=#v1_1_0_allow_newlines_in_inline_tables><code>v1_1_0_allow_newlines_in_inline_tables</code></a></li><li><a href=#v1_1_0_allow_trailing_comma_in_inline_tables><code>v1_1_0_allow_trailing_comma_in_inline_tables</code></a></li><li><a href=#v1_1_0_add_escape_sequence_e><code>v1_1_0_add_escape_sequence_e</code></a></li><li><a href=#v1_1_0_add_escape_sequence_x><code>v1_1_0_add_escape_sequence_x</code></a></li><li><a href=#v1_1_0_make_seconds_optional><code>v1_1_0_make_seconds_optional</code></a></li><li><a href=#ext_hex_float><code>ext_hex_float</code></a></li><li><a href=#ext_num_suffix><code>ext_num_suffix</code></a></li><li><a href=#ext_null_value><code>ext_null_value</code></a></li></ul></li></ul></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,19 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
toml.hpp
#
toml.hpp includes all other headers.
This allows access to all features of toml11.
This header file and toml_fwd.hpp are located under ${TOML11_INCLUDE_DIR}/,
while other header files are located under ${toml11_include_dir}/toml11/."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/toml/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="toml.hpp"><meta property="og:description" content="toml.hpp # toml.hpp includes all other headers.
This allows access to all features of toml11.
This header file and toml_fwd.hpp are located under ${TOML11_INCLUDE_DIR}/, while other header files are located under ${toml11_include_dir}/toml11/."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>toml.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/toml/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/toml/ title=toml.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/toml/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/ class=active>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>toml.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#tomlhpp>toml.hpp</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=tomlhpp>toml.hpp
<a class=anchor href=#tomlhpp>#</a></h1><p><code>toml.hpp</code> includes all other headers.</p><p>This allows access to all features of toml11.</p><p>This header file and <code>toml_fwd.hpp</code> are located under <code>${TOML11_INCLUDE_DIR}/</code>,
while other header files are located under <code>${toml11_include_dir}/toml11/</code>.</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#tomlhpp>toml.hpp</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,21 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
toml_fwd.hpp
#
toml_fwd.hpp contains forward declarations of structures defined in toml11 and macro definitions.
When only forward declarations of toml11 structures are needed and implementation is not required, including toml_fwd.hpp instead of toml.hpp can reduce compilation time.
Since this file only contains forward declarations, you cannot use toml::table, defined as toml::basic_value<toml::type_config>::table_type, and similarly defined toml::array. This is because they require the implementation of basic_value.
This header file and toml.hpp are located under ${TOML11_INCLUDE_DIR}/, while other header files are located under ${TOML11_INCLUDE_DIR}/toml11/."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/toml_fwd/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="toml_fwd.hpp"><meta property="og:description" content="toml_fwd.hpp # toml_fwd.hpp contains forward declarations of structures defined in toml11 and macro definitions.
When only forward declarations of toml11 structures are needed and implementation is not required, including toml_fwd.hpp instead of toml.hpp can reduce compilation time.
Since this file only contains forward declarations, you cannot use toml::table, defined as toml::basic_value<toml::type_config>::table_type, and similarly defined toml::array. This is because they require the implementation of basic_value. This header file and toml.hpp are located under ${TOML11_INCLUDE_DIR}/, while other header files are located under ${TOML11_INCLUDE_DIR}/toml11/."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>toml_fwd.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/toml_fwd/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/toml_fwd/ title=toml_fwd.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/toml_fwd/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/ class=active>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>toml_fwd.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#toml_fwdhpp>toml_fwd.hpp</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=toml_fwdhpp>toml_fwd.hpp
<a class=anchor href=#toml_fwdhpp>#</a></h1><p><code>toml_fwd.hpp</code> contains forward declarations of structures defined in toml11 and macro definitions.</p><p>When only forward declarations of toml11 structures are needed and implementation is not required, including <code>toml_fwd.hpp</code> instead of <code>toml.hpp</code> can reduce compilation time.</p><blockquote class="book-hint warning">Since this file only contains forward declarations, you cannot use <code>toml::table</code>, defined as <code>toml::basic_value&lt;toml::type_config>::table_type</code>, and similarly defined <code>toml::array</code>. This is because they require the implementation of <code>basic_value</code>.</blockquote><p>This header file and <code>toml.hpp</code> are located under <code>${TOML11_INCLUDE_DIR}/</code>, while other header files are located under <code>${TOML11_INCLUDE_DIR}/toml11/</code>.</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#toml_fwdhpp>toml_fwd.hpp</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,148 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
types.hpp
#
This document defines classes that specifies type information.
type_config
#
type_config is a type that encapsulates parameters given to toml::basic_value.
When using different types within toml::basic_value<T>, you need to define and pass this type separately.
All elements listed are required.
If you use numerical types that cannot use standard stream operators, define and replace the equivalents for read_int and read_float.
namespace toml
{
struct type_config
{
using comment_type = preserve_comments;
using boolean_type = bool;
using integer_type = std::int64_t;
using floating_type = double;
using string_type = std::string;
template<typename T>
using array_type = std::vector<T>;
template<typename K, typename T>
using table_type = std::unordered_map<K, T>;
static result<integer_type, error_info>
parse_int(const std::string& str, const source_location src, const std::uint8_t base);
static result<floating_type, error_info>
parse_float(const std::string& str, const source_location src, const bool is_hex);
};
using value = basic_value<type_config>;
using table = typename value::table_type;
using array = typename value::array_type;
} // toml
static Member Functions
#
parse_int(str, src, base)
#
static result<integer_type, error_info>
parse_int(const std::string& str, const source_location src, const std::uint8_t base);
If you use a type as integer_type that cannot utilize standard stream operators, implement this function.
Otherwise, use read_int described later."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/types/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="types.hpp"><meta property="og:description" content="types.hpp # This document defines classes that specifies type information.
type_config # type_config is a type that encapsulates parameters given to toml::basic_value.
When using different types within toml::basic_value<T>, you need to define and pass this type separately. All elements listed are required.
If you use numerical types that cannot use standard stream operators, define and replace the equivalents for read_int and read_float.
namespace toml { struct type_config { using comment_type = preserve_comments; using boolean_type = bool; using integer_type = std::int64_t; using floating_type = double; using string_type = std::string; template<typename T> using array_type = std::vector<T>; template<typename K, typename T> using table_type = std::unordered_map<K, T>; static result<integer_type, error_info> parse_int(const std::string& str, const source_location src, const std::uint8_t base); static result<floating_type, error_info> parse_float(const std::string& str, const source_location src, const bool is_hex); }; using value = basic_value<type_config>; using table = typename value::table_type; using array = typename value::array_type; } // toml static Member Functions # parse_int(str, src, base) # static result<integer_type, error_info> parse_int(const std::string& str, const source_location src, const std::uint8_t base); If you use a type as integer_type that cannot utilize standard stream operators, implement this function. Otherwise, use read_int described later."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>types.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/types/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/types/ title=types.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/types/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/ class=active>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>types.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#typeshpp>types.hpp</a></li><li><a href=#type_config><code>type_config</code></a><ul><li><a href=#static-member-functions><code>static</code> Member Functions</a><ul><li><a href=#parse_intstr-src-base><code>parse_int(str, src, base)</code></a></li><li><a href=#parse_floatstr-src-is_hex><code>parse_float(str, src, is_hex)</code></a></li></ul></li><li><a href=#non-member-functions>Non-member Functions</a><ul><li><a href=#read_int><code>read_int</code></a></li><li><a href=#read_float><code>read_float</code></a></li></ul></li></ul></li><li><a href=#ordered_type_config><code>ordered_type_config</code></a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=typeshpp>types.hpp
<a class=anchor href=#typeshpp>#</a></h1><p>This document defines classes that specifies type information.</p><h1 id=type_config><code>type_config</code>
<a class=anchor href=#type_config>#</a></h1><p><code>type_config</code> is a type that encapsulates parameters given to <code>toml::basic_value</code>.</p><p>When using different types within <code>toml::basic_value&lt;T></code>, you need to define and pass this type separately.
All elements listed are required.</p><p>If you use numerical types that cannot use standard stream operators, define and replace the equivalents for <code>read_int</code> and <code>read_float</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>type_config</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> comment_type <span style=color:#f92672>=</span> preserve_comments;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> boolean_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>bool</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> integer_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>int64_t</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> floating_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>double</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> string_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>string;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> array_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> K, <span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> table_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>unordered_map<span style=color:#f92672>&lt;</span>K, T<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>static</span> result<span style=color:#f92672>&lt;</span>integer_type, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> parse_int(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint8_t</span> base);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>static</span> result<span style=color:#f92672>&lt;</span>floating_type, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> parse_float(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>bool</span> is_hex);
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> value <span style=color:#f92672>=</span> basic_value<span style=color:#f92672>&lt;</span>type_config<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> table <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> value<span style=color:#f92672>::</span>table_type;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> array <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> value<span style=color:#f92672>::</span>array_type;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h2 id=static-member-functions><code>static</code> Member Functions
<a class=anchor href=#static-member-functions>#</a></h2><h3 id=parse_intstr-src-base><code>parse_int(str, src, base)</code>
<a class=anchor href=#parse_intstr-src-base>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>static</span> result<span style=color:#f92672>&lt;</span>integer_type, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse_int(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint8_t</span> base);
</span></span></code></pre></div><p>If you use a type as <code>integer_type</code> that cannot utilize standard stream operators, implement this function.
Otherwise, use <code>read_int</code> described later.</p><p>The <code>str</code> parameter receives a string with prefixes, leading zeros, and underscores removed.</p><p>The <code>src</code> parameter receives a <code>source_location</code> pointing to where the string was defined.</p><p>The <code>base</code> parameter receives one of <code>10</code>, <code>2</code>, <code>8</code>, or <code>16</code>.</p><h3 id=parse_floatstr-src-is_hex><code>parse_float(str, src, is_hex)</code>
<a class=anchor href=#parse_floatstr-src-is_hex>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>static</span> result<span style=color:#f92672>&lt;</span>floating_type, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>parse_float(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>bool</span> is_hex);
</span></span></code></pre></div><p>If you use a type as <code>floating_type</code> that cannot utilize standard stream operators, implement this function.
Otherwise, use <code>read_float</code> described later.</p><p>The <code>str</code> parameter receives a string with prefixes, leading zeros, and underscores removed.</p><p>The <code>src</code> parameter receives a <code>source_location</code> pointing to where the string was defined.</p><p>The <code>is_hex</code> parameter indicates whether the format is <code>hexfloat</code>. If you don&rsquo;t use the <code>hexfloat</code> extension, you don&rsquo;t need to implement this.</p><p>For details on the <code>hexfloat</code> extension, refer to <a href=https://toruniina.github.io/toml11/docs/reference/spec/>spec.hpp</a>.</p><h2 id=non-member-functions>Non-member Functions
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=read_int><code>read_int</code>
<a class=anchor href=#read_int>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>T, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>read_int(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint8_t</span> base);
</span></span></code></pre></div><p>This is the default function used. It parses using <code>std::istringstream</code>.</p><p>If <code>operator>></code> and manipulators like <code>std::hex</code>, and <code>std::numeric_limits&lt;T></code> are defined (such as for <code>boost::multiprecision</code>), you can use this without modifications.</p><h3 id=read_float><code>read_float</code>
<a class=anchor href=#read_float>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>result<span style=color:#f92672>&lt;</span>T, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>read_float(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>bool</span> is_hex);
</span></span></code></pre></div><p>This is the default function used. It parses decimals using <code>std::istringstream</code> and hexfloats using <code>sscanf()</code>.</p><p>It supports <code>double</code> and <code>float</code>.</p><p>For other types, if <code>operator>></code> is defined and <code>hex</code> is not used, you can use this function.</p><h1 id=ordered_type_config><code>ordered_type_config</code>
<a class=anchor href=#ordered_type_config>#</a></h1><p><code>ordered_type_config</code> is a variation of <code>toml::type_config</code> where the table type is replaced with <code>toml::ordered_map</code>.
Additionally, it defines the <code>toml::ordered_value</code> alias.</p><p>Other than these changes, it is identical to <code>type_config</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>ordered_type_config</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> comment_type <span style=color:#f92672>=</span> preserve_comments;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> boolean_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>bool</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> integer_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>int64_t</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> floating_type <span style=color:#f92672>=</span> <span style=color:#66d9ef>double</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> string_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>string;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> array_type <span style=color:#f92672>=</span> std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span> <span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> K, <span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>using</span> table_type <span style=color:#f92672>=</span> ordered_map<span style=color:#f92672>&lt;</span>K, T<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>static</span> result<span style=color:#f92672>&lt;</span>integer_type, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> parse_int(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint8_t</span> base)
</span></span><span style=display:flex><span> {
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> read_int<span style=color:#f92672>&lt;</span>integer_type<span style=color:#f92672>&gt;</span>(str, src, base);
</span></span><span style=display:flex><span> }
</span></span><span style=display:flex><span> <span style=color:#66d9ef>static</span> result<span style=color:#f92672>&lt;</span>floating_type, error_info<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span> parse_float(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>string<span style=color:#f92672>&amp;</span> str, <span style=color:#66d9ef>const</span> source_location src, <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>bool</span> is_hex)
</span></span><span style=display:flex><span> {
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> read_float<span style=color:#f92672>&lt;</span>floating_type<span style=color:#f92672>&gt;</span>(str, src, is_hex);
</span></span><span style=display:flex><span> }
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_value <span style=color:#f92672>=</span> basic_value<span style=color:#f92672>&lt;</span>ordered_type_config<span style=color:#f92672>&gt;</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_table <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> ordered_value<span style=color:#f92672>::</span>table_type;
</span></span><span style=display:flex><span><span style=color:#66d9ef>using</span> ordered_array <span style=color:#f92672>=</span> <span style=color:#66d9ef>typename</span> ordered_value<span style=color:#f92672>::</span>array_type;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#typeshpp>types.hpp</a></li><li><a href=#type_config><code>type_config</code></a><ul><li><a href=#static-member-functions><code>static</code> Member Functions</a><ul><li><a href=#parse_intstr-src-base><code>parse_int(str, src, base)</code></a></li><li><a href=#parse_floatstr-src-is_hex><code>parse_float(str, src, is_hex)</code></a></li></ul></li><li><a href=#non-member-functions>Non-member Functions</a><ul><li><a href=#read_int><code>read_int</code></a></li><li><a href=#read_float><code>read_float</code></a></li></ul></li></ul></li><li><a href=#ordered_type_config><code>ordered_type_config</code></a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,439 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
value.hpp
#
value.hpp defines basic_value.
toml::basic_value
#
basic_value is a class that stores TOML values.
namespace toml
{
template <class TypeConfig>
class basic_value;
// Defined in types.hpp
// using value = basic_value<type_config>;
// using table = typename basic_value<type_config>::table_type;
// using array = typename basic_value<type_config>::array_type;
template<typename TC>
bool operator==(const basic_value<TC>&, const basic_value<TC>&);
template<typename TC>
bool operator!=(const basic_value<TC>&, const basic_value<TC>&);
template<typename TC>
bool operator< (const basic_value<TC>&, const basic_value<TC>&);
template<typename TC>
bool operator<=(const basic_value<TC>&, const basic_value<TC>&);
template<typename TC>
bool operator> (const basic_value<TC>&, const basic_value<TC>&);
template<typename TC>
bool operator>=(const basic_value<TC>&, const basic_value<TC>&);
} //toml
Member Types
#
The following member types are defined."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/value/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="value.hpp"><meta property="og:description" content="value.hpp # value.hpp defines basic_value.
toml::basic_value # basic_value is a class that stores TOML values.
namespace toml { template <class TypeConfig> class basic_value; // Defined in types.hpp // using value = basic_value<type_config>; // using table = typename basic_value<type_config>::table_type; // using array = typename basic_value<type_config>::array_type; template<typename TC> bool operator==(const basic_value<TC>&, const basic_value<TC>&); template<typename TC> bool operator!=(const basic_value<TC>&, const basic_value<TC>&); template<typename TC> bool operator< (const basic_value<TC>&, const basic_value<TC>&); template<typename TC> bool operator<=(const basic_value<TC>&, const basic_value<TC>&); template<typename TC> bool operator> (const basic_value<TC>&, const basic_value<TC>&); template<typename TC> bool operator>=(const basic_value<TC>&, const basic_value<TC>&); } //toml Member Types # The following member types are defined."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>value.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/value/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/value/ title=value.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/value/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/ class=active>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>value.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#valuehpp>value.hpp</a></li><li><a href=#tomlbasic_value><code>toml::basic_value</code></a><ul><li><a href=#member-types>Member Types</a></li><li><a href=#member-functions>Member Functions</a><ul><li><a href=#default-constructor>Default Constructor</a></li><li><a href=#copy-and-move-constructors>Copy and Move Constructors</a></li><li><a href=#copy-and-move-constructors-with-comments>Copy and Move Constructors with Comments</a></li><li><a href=#conversion-constructors>Conversion Constructors</a></li><li><a href=#constructor-boolean>Constructor (boolean)</a></li><li><a href=#constructor-integer>Constructor (integer)</a></li><li><a href=#constructor-floating>Constructor (floating)</a></li><li><a href=#constructor-string>Constructor (string)</a></li><li><a href=#constructor-local_date>Constructor (local_date)</a></li><li><a href=#constructor-local_time>Constructor (local_time)</a></li><li><a href=#constructor-local_datetime>Constructor (local_datetime)</a></li><li><a href=#constructor-offset_datetime>Constructor (offset_datetime)</a></li><li><a href=#constructor-array>Constructor (array)</a></li><li><a href=#constructor-table>Constructor (table)</a></li><li><a href=#constructor-user-defined>Constructor (user-defined)</a></li><li><a href=#operatorbasic_value><code>operator=(basic_value)</code></a></li><li><a href=#operatort><code>operator=(T)</code></a></li><li><a href=#ist><code>is&lt;T>()</code></a></li><li><a href=#istomlvalue_t><code>is(toml::value_t)</code></a></li><li><a href=#is_xxx><code>is_xxx()</code></a></li><li><a href=#is_empty><code>is_empty()</code></a></li><li><a href=#is_array_of_tables><code>is_array_of_tables()</code></a></li><li><a href=#type><code>type()</code></a></li><li><a href=#as_xxx><code>as_xxx()</code></a></li><li><a href=#as_xxxstdnothrow><code>as_xxx(std::nothrow)</code></a></li><li><a href=#as_xxx_fmt><code>as_xxx_fmt()</code></a></li><li><a href=#as_xxx_fmtstdnothrow><code>as_xxx_fmt(std::nothrow)</code></a></li><li><a href=#atkey><code>at(key)</code></a></li><li><a href=#countkey><code>count(key)</code></a></li><li><a href=#containskey><code>contains(key)</code></a></li><li><a href=#atidx><code>at(idx)</code></a></li><li><a href=#operatoridx><code>operator[](idx)</code></a></li><li><a href=#push_backvalue><code>push_back(value)</code></a></li><li><a href=#emplace_backargs><code>emplace_back(args...)</code></a></li><li><a href=#size><code>size()</code></a></li><li><a href=#location><code>location()</code></a></li><li><a href=#comments><code>comments()</code></a></li><li><a href=#accessed><code>accessed()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#operator><code>operator==</code></a></li><li><a href=#operator-1><code>operator!=</code></a></li><li><a href=#operator-2><code>operator&lt;</code></a></li><li><a href=#operator-3><code>operator&lt;=</code></a></li><li><a href=#operator-4><code>operator></code></a></li><li><a href=#operator-5><code>operator>=</code></a></li></ul></li></ul></li><li><a href=#tomltype_error><code>toml::type_error</code></a></li><li><a href=#tomlmake_error_info><code>toml::make_error_info</code></a></li><li><a href=#tomlformat_error><code>toml::format_error</code></a></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=valuehpp>value.hpp
<a class=anchor href=#valuehpp>#</a></h1><p><code>value.hpp</code> defines <code>basic_value</code>.</p><h1 id=tomlbasic_value><code>toml::basic_value</code>
<a class=anchor href=#tomlbasic_value>#</a></h1><p><code>basic_value</code> is a class that stores TOML values.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span> <span style=color:#f92672>&lt;</span><span style=color:#66d9ef>class</span> <span style=color:#a6e22e>TypeConfig</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>class</span> <span style=color:#a6e22e>basic_value</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#75715e>// Defined in types.hpp
</span></span></span><span style=display:flex><span><span style=color:#75715e>// using value = basic_value&lt;type_config&gt;;
</span></span></span><span style=display:flex><span><span style=color:#75715e>// using table = typename basic_value&lt;type_config&gt;::table_type;
</span></span></span><span style=display:flex><span><span style=color:#75715e>// using array = typename basic_value&lt;type_config&gt;::array_type;
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>==</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>!=</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;</span> (<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;=</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;</span> (<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;=</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span><span style=display:flex><span>} <span style=color:#75715e>//toml
</span></span></span></code></pre></div><h2 id=member-types>Member Types
<a class=anchor href=#member-types>#</a></h2><p>The following member types are defined.</p><p>You can modify the member types using <code>TypeConfig</code>.</p><p>See also: <a href=https://toruniina.github.io/toml11/docs/reference/types/>types.hpp</a></p><table><thead><tr><th style=text-align:left>Name</th><th style=text-align:left>Definition</th></tr></thead><tbody><tr><td style=text-align:left><code>char_type</code></td><td style=text-align:left><code>typename TypeConfig::char_type</code></td></tr><tr><td style=text-align:left><code>key_type</code></td><td style=text-align:left><code>typename TypeConfig::string_type</code></td></tr><tr><td style=text-align:left><code>value_type</code></td><td style=text-align:left><code>basic_value&lt;TypeConfig></code></td></tr><tr><td style=text-align:left><code>boolean_type</code></td><td style=text-align:left><code>typename TypeConfig::boolean_type</code></td></tr><tr><td style=text-align:left><code>integer_type</code></td><td style=text-align:left><code>typename TypeConfig::integer_type</code></td></tr><tr><td style=text-align:left><code>floating_type</code></td><td style=text-align:left><code>typename TypeConfig::floating_type</code></td></tr><tr><td style=text-align:left><code>string_type</code></td><td style=text-align:left><code>typename TypeConfig::string_type</code></td></tr><tr><td style=text-align:left><code>local_time_type</code></td><td style=text-align:left><code>toml::local_time</code></td></tr><tr><td style=text-align:left><code>local_date_type</code></td><td style=text-align:left><code>toml::local_date</code></td></tr><tr><td style=text-align:left><code>local_datetime_type</code></td><td style=text-align:left><code>toml::local_datetime</code></td></tr><tr><td style=text-align:left><code>offset_datetime_type</code></td><td style=text-align:left><code>toml::offset_datetime</code></td></tr><tr><td style=text-align:left><code>array_type</code></td><td style=text-align:left><code>typename TypeConfig::template array_type&lt;value_type></code></td></tr><tr><td style=text-align:left><code>table_type</code></td><td style=text-align:left><code>typename TypeConfig::template table_type&lt;key_type, value_type></code></td></tr><tr><td style=text-align:left><code>comment_type</code></td><td style=text-align:left><code>typename TypeConfig::comment_type</code></td></tr></tbody></table><h2 id=member-functions>Member Functions
<a class=anchor href=#member-functions>#</a></h2><h3 id=default-constructor>Default Constructor
<a class=anchor href=#default-constructor>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value() <span style=color:#66d9ef>noexcept</span>
</span></span></code></pre></div><p>Constructs an empty <code>toml::value</code>.</p><p>The constructed <code>toml::value</code> will be empty.</p><h3 id=copy-and-move-constructors>Copy and Move Constructors
<a class=anchor href=#copy-and-move-constructors>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&amp;</span> v)
</span></span><span style=display:flex><span>basic_value(basic_value<span style=color:#f92672>&amp;&amp;</span> v)
</span></span></code></pre></div><p>Copies or moves all information including values, format information, comments, and file regions.</p><h3 id=copy-and-move-constructors-with-comments>Copy and Move Constructors with Comments
<a class=anchor href=#copy-and-move-constructors-with-comments>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(basic_value v, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Copies or moves the object while overwriting comments.</p><h3 id=conversion-constructors>Conversion Constructors
<a class=anchor href=#conversion-constructors>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TI<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(basic_value<span style=color:#f92672>&lt;</span>TI<span style=color:#f92672>&gt;</span> other)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TI<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(basic_value<span style=color:#f92672>&lt;</span>TI<span style=color:#f92672>&gt;</span> other, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Copies or moves from a <code>basic_value</code> with a different <code>type_config</code>.</p><h3 id=constructor-boolean>Constructor (boolean)
<a class=anchor href=#constructor-boolean>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(boolean_type x)
</span></span><span style=display:flex><span>basic_value(boolean_type x, boolean_format_info fmt)
</span></span><span style=display:flex><span>basic_value(boolean_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(boolean_type x, boolean_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with a <code>bool</code>, its format information, and comments.</p><h3 id=constructor-integer>Constructor (integer)
<a class=anchor href=#constructor-integer>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_integral&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_integral&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, integer_format_info fmt)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_integral&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_integral&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, integer_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with an <code>integer</code>, its format information, and comments.</p><h3 id=constructor-floating>Constructor (floating)
<a class=anchor href=#constructor-floating>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_floating_point&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_floating_point&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, floating_format_info fmt)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_floating_point&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* std::is_floating_point&lt;T&gt; is true */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, floating_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with a <code>floating</code> point number, its format information, and comments.</p><h3 id=constructor-string>Constructor (string)
<a class=anchor href=#constructor-string>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(string_type x)
</span></span><span style=display:flex><span>basic_value(string_type x, string_format_info fmt)
</span></span><span style=display:flex><span>basic_value(string_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(string_type x, string_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> string_type<span style=color:#f92672>::</span>value_type<span style=color:#f92672>*</span> x)
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> string_type<span style=color:#f92672>::</span>value_type<span style=color:#f92672>*</span> x, string_format_info fmt)
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> string_type<span style=color:#f92672>::</span>value_type<span style=color:#f92672>*</span> x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> string_type<span style=color:#f92672>::</span>value_type<span style=color:#f92672>*</span> x, string_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#75715e>// C++17以降
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>basic_value(string_view_type x)
</span></span><span style=display:flex><span>basic_value(string_view_type x, string_format_info fmt)
</span></span><span style=display:flex><span>basic_value(string_view_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(string_view_type x, string_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with a <code>string</code>, its format information, and comments.</p><p><code>string_view_type</code> shares the same <code>value_type</code> and <code>traits_type</code> as <code>string_type</code>.</p><h3 id=constructor-local_date>Constructor (local_date)
<a class=anchor href=#constructor-local_date>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(local_date_type x)
</span></span><span style=display:flex><span>basic_value(local_date_type x, local_date_format_info fmt)
</span></span><span style=display:flex><span>basic_value(local_date_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(local_date_type x, local_date_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with a <code>local_date_type</code>, its format information, and comments.</p><h3 id=constructor-local_time>Constructor (local_time)
<a class=anchor href=#constructor-local_time>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(local_time_type x)
</span></span><span style=display:flex><span>basic_value(local_time_type x, local_time_format_info fmt)
</span></span><span style=display:flex><span>basic_value(local_time_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(local_time_type x, local_time_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> Rep, <span style=color:#66d9ef>typename</span> Period<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>duration<span style=color:#f92672>&lt;</span>Rep, Period<span style=color:#f92672>&gt;&amp;</span> x)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> Rep, <span style=color:#66d9ef>typename</span> Period<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>duration<span style=color:#f92672>&lt;</span>Rep, Period<span style=color:#f92672>&gt;&amp;</span> x, local_time_format_info fmt)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> Rep, <span style=color:#66d9ef>typename</span> Period<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>duration<span style=color:#f92672>&lt;</span>Rep, Period<span style=color:#f92672>&gt;&amp;</span> x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> Rep, <span style=color:#66d9ef>typename</span> Period<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>duration<span style=color:#f92672>&lt;</span>Rep, Period<span style=color:#f92672>&gt;&amp;</span> x, local_time_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with a <code>local_time_type</code>, its format information, and comments.</p><p>For <code>std::chrono::duration</code>, constructs as a time span from <code>00:00:00</code>.</p><h3 id=constructor-local_datetime>Constructor (local_datetime)
<a class=anchor href=#constructor-local_datetime>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(local_datetime_type x)
</span></span><span style=display:flex><span>basic_value(local_datetime_type x, local_date_format_info fmt)
</span></span><span style=display:flex><span>basic_value(local_datetime_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(local_datetime_type x, local_date_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with a <code>local_datetime_type</code>, its format information, and comments.</p><h3 id=constructor-offset_datetime>Constructor (offset_datetime)
<a class=anchor href=#constructor-offset_datetime>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(offset_datetime_type x)
</span></span><span style=display:flex><span>basic_value(offset_datetime_type x, offset_date_format_info fmt)
</span></span><span style=display:flex><span>basic_value(offset_datetime_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(offset_datetime_type x, offset_date_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>basic_value(std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>system_clock<span style=color:#f92672>::</span>time_point x)
</span></span><span style=display:flex><span>basic_value(std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>system_clock<span style=color:#f92672>::</span>time_point x, offset_date_format_info fmt)
</span></span><span style=display:flex><span>basic_value(std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>system_clock<span style=color:#f92672>::</span>time_point x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(std<span style=color:#f92672>::</span>chrono<span style=color:#f92672>::</span>system_clock<span style=color:#f92672>::</span>time_point x, offset_date_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with an <code>offset_datetime_type</code>, its format information, and comments.</p><p>For <code>std::chrono::system_clock::time_point</code>, constructs for the pointed time.</p><h3 id=constructor-array>Constructor (array)
<a class=anchor href=#constructor-array>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(array_type x)
</span></span><span style=display:flex><span>basic_value(array_type x, integer_format_info fmt)
</span></span><span style=display:flex><span>basic_value(array_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(array_type x, integer_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is array-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is array-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, array_format_info fmt)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is array-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is array-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, array_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with an <code>array</code>, its format information, and comments.</p><p><code>array-like</code> types must meet the following criteria:</p><ul><li>Has <code>T::iterator</code>.</li><li>Has <code>T::value_type</code>.</li><li>Does <strong>not</strong> have <code>T::key_type</code>.</li><li>Does <strong>not</strong> have <code>T::mapped_type</code>.</li><li>Is <strong>not</strong> <code>std::string</code>.</li><li>Is <strong>not</strong> <code>std::string_view</code> (since C++17).</li></ul><h3 id=constructor-table>Constructor (table)
<a class=anchor href=#constructor-table>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value(table_type x)
</span></span><span style=display:flex><span>basic_value(table_type x, integer_format_info fmt)
</span></span><span style=display:flex><span>basic_value(table_type x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>basic_value(table_type x, integer_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is table-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is table-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, table_format_info fmt)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is table-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T, <span style=color:#75715e>/* T is table-like */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(T x, table_format_info fmt, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com)
</span></span></code></pre></div><p>Constructs an object with a <code>table</code>, its format information, and comments.</p><p><code>table-like</code> types must meet the following criteria:</p><ul><li>Has <code>T::iterator</code>.</li><li>Has <code>T::value_type</code>.</li><li>Has <code>T::key_type</code>.</li><li>Has <code>T::mapped_type</code>.</li></ul><h3 id=constructor-user-defined>Constructor (user-defined)
<a class=anchor href=#constructor-user-defined>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T <span style=color:#75715e>/* toml::into&lt;T&gt; is defined */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> T<span style=color:#f92672>&amp;</span> ud);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T <span style=color:#75715e>/* toml::into&lt;T&gt; is defined */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> T<span style=color:#f92672>&amp;</span> ud, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T <span style=color:#75715e>/* toml::into&lt;T&gt; is not defined, but T{}.into_toml() exists */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> T<span style=color:#f92672>&amp;</span> ud);
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T <span style=color:#75715e>/* toml::into&lt;T&gt; is not defined, but T{}.into_toml() exists */</span><span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value(<span style=color:#66d9ef>const</span> T<span style=color:#f92672>&amp;</span> ud, std<span style=color:#f92672>::</span>vector<span style=color:#f92672>&lt;</span>std<span style=color:#f92672>::</span>string<span style=color:#f92672>&gt;</span> com);
</span></span></code></pre></div><p>If <code>toml::into&lt;T></code> is defined, constructs from the result of <code>toml::into&lt;T>(ud)</code>.</p><p>If <code>toml::into&lt;T></code> is not defined but <code>T</code> has a <code>into_toml()</code> member function, constructs from the result of <code>ud.into_toml()</code>.</p><hr><h3 id=operatorbasic_value><code>operator=(basic_value)</code>
<a class=anchor href=#operatorbasic_value>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>basic_value<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&amp;</span> v)
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(basic_value<span style=color:#f92672>&amp;&amp;</span> v)
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TI<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(basic_value<span style=color:#f92672>&lt;</span>TI<span style=color:#f92672>&gt;</span> other)
</span></span></code></pre></div><p>Assigns the right-hand side <code>basic_value</code> to the current object.</p><h3 id=operatort><code>operator=(T)</code>
<a class=anchor href=#operatort>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> T<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>basic_value<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>=</span>(T x)
</span></span></code></pre></div><p>Assigns a value corresponding to <code>T</code>.</p><p>The contents pointed to by <code>source_location</code> are discarded.</p><p>If the object already holds a value of the same type, the original format information is retained.</p><hr><h3 id=ist><code>is&lt;T>()</code>
<a class=anchor href=#ist>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> is<span style=color:#f92672>&lt;</span>T<span style=color:#f92672>&gt;</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>
</span></span></code></pre></div><h4 id=requirements>Requirements
<a class=anchor href=#requirements>#</a></h4><p><code>T</code> must be an exact TOML type, meaning it corresponds to one of the <code>toml::value::xxx_type</code>.</p><h4 id=return-value>Return Value
<a class=anchor href=#return-value>#</a></h4><p>Returns <code>true</code> if the stored type matches <code>T</code>, otherwise returns <code>false</code>.</p><hr><h3 id=istomlvalue_t><code>is(toml::value_t)</code>
<a class=anchor href=#istomlvalue_t>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> is(toml<span style=color:#f92672>::</span>value_t t) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>
</span></span></code></pre></div><h4 id=return-value-1>Return Value
<a class=anchor href=#return-value-1>#</a></h4><p>Returns <code>true</code> if the tag of the stored type matches <code>t</code>, otherwise returns <code>false</code>.</p><hr><h3 id=is_xxx><code>is_xxx()</code>
<a class=anchor href=#is_xxx>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_boolean</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_integer</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_floating</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_string</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_offset_datetime</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_local_datetime</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_local_date</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_local_time</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_array</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_table</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><h4 id=return-value-2>Return Value
<a class=anchor href=#return-value-2>#</a></h4><p>Returns <code>true</code> if the stored type matches the corresponding type, otherwise returns <code>false</code>.</p><hr><h3 id=is_empty><code>is_empty()</code>
<a class=anchor href=#is_empty>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_empty</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><h4 id=return-value-3>Return Value
<a class=anchor href=#return-value-3>#</a></h4><p>Returns <code>true</code> if the object is default constructed and no value is assigned, otherwise returns <code>false</code>.</p><h3 id=is_array_of_tables><code>is_array_of_tables()</code>
<a class=anchor href=#is_array_of_tables>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>is_array_of_tables</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><h4 id=return-value-4>Return Value
<a class=anchor href=#return-value-4>#</a></h4><p>Returns <code>true</code> if the stored type is an array that is not empty and all elements are tables, otherwise returns <code>false</code>.</p><hr><h3 id=type><code>type()</code>
<a class=anchor href=#type>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>toml<span style=color:#f92672>::</span>value_t type() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>
</span></span></code></pre></div><h4 id=return-value-5>Return Value
<a class=anchor href=#return-value-5>#</a></h4><p>Returns the tag corresponding to the stored type.</p><hr><h3 id=as_xxx><code>as_xxx()</code>
<a class=anchor href=#as_xxx>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>boolean_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_boolean () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>integer_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_integer () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>floating_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_floating () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>string_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_string () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>offset_datetime_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_offset_datetime() <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>local_datetime_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_datetime () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>local_date_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_date () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>local_time_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_time () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>array_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_array () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>table_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_table () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>boolean_type <span style=color:#f92672>&amp;</span> as_boolean ();
</span></span><span style=display:flex><span>integer_type <span style=color:#f92672>&amp;</span> as_integer ();
</span></span><span style=display:flex><span>floating_type <span style=color:#f92672>&amp;</span> as_floating ();
</span></span><span style=display:flex><span>string_type <span style=color:#f92672>&amp;</span> as_string ();
</span></span><span style=display:flex><span>offset_datetime_type<span style=color:#f92672>&amp;</span> as_offset_datetime();
</span></span><span style=display:flex><span>local_datetime_type <span style=color:#f92672>&amp;</span> as_local_datetime ();
</span></span><span style=display:flex><span>local_date_type <span style=color:#f92672>&amp;</span> as_local_date ();
</span></span><span style=display:flex><span>local_time_type <span style=color:#f92672>&amp;</span> as_local_time ();
</span></span><span style=display:flex><span>array_type <span style=color:#f92672>&amp;</span> as_array ();
</span></span><span style=display:flex><span>table_type <span style=color:#f92672>&amp;</span> as_table ();
</span></span></code></pre></div><h4 id=return-value-6>Return Value
<a class=anchor href=#return-value-6>#</a></h4><p>Returns a reference to the value of the specified type.</p><h4 id=exception>Exception
<a class=anchor href=#exception>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value&rsquo;s type does not match the specified type.</p><hr><h3 id=as_xxxstdnothrow><code>as_xxx(std::nothrow)</code>
<a class=anchor href=#as_xxxstdnothrow>#</a></h3><p>Invoke with a <code>std::nothrow</code> object.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>boolean_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_boolean (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>integer_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_integer (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>floating_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_floating (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>string_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_string (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>offset_datetime_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_offset_datetime(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_datetime_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_datetime (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_date_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_date (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_time_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_time (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>array_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_array (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>table_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_table (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>boolean_type <span style=color:#f92672>&amp;</span> as_boolean (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>integer_type <span style=color:#f92672>&amp;</span> as_integer (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>floating_type <span style=color:#f92672>&amp;</span> as_floating (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>string_type <span style=color:#f92672>&amp;</span> as_string (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>offset_datetime_type<span style=color:#f92672>&amp;</span> as_offset_datetime(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_datetime_type <span style=color:#f92672>&amp;</span> as_local_datetime (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_date_type <span style=color:#f92672>&amp;</span> as_local_date (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_time_type <span style=color:#f92672>&amp;</span> as_local_time (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>array_type <span style=color:#f92672>&amp;</span> as_array (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>table_type <span style=color:#f92672>&amp;</span> as_table (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><h4 id=return-value-7>Return Value
<a class=anchor href=#return-value-7>#</a></h4><p>Returns a reference to the value of the specified type.</p><h4 id=note>Note
<a class=anchor href=#note>#</a></h4><p>If the type of the stored value does not match the specified type, the behavior is undefined.</p><hr><h3 id=as_xxx_fmt><code>as_xxx_fmt()</code>
<a class=anchor href=#as_xxx_fmt>#</a></h3><p>Accesses format information.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>boolean_format_info <span style=color:#f92672>&amp;</span> as_boolean_fmt ();
</span></span><span style=display:flex><span>integer_format_info <span style=color:#f92672>&amp;</span> as_integer_fmt ();
</span></span><span style=display:flex><span>floating_format_info <span style=color:#f92672>&amp;</span> as_floating_fmt ();
</span></span><span style=display:flex><span>string_format_info <span style=color:#f92672>&amp;</span> as_string_fmt ();
</span></span><span style=display:flex><span>offset_datetime_format_info<span style=color:#f92672>&amp;</span> as_offset_datetime_fmt();
</span></span><span style=display:flex><span>local_datetime_format_info <span style=color:#f92672>&amp;</span> as_local_datetime_fmt ();
</span></span><span style=display:flex><span>local_date_format_info <span style=color:#f92672>&amp;</span> as_local_date_fmt ();
</span></span><span style=display:flex><span>local_time_format_info <span style=color:#f92672>&amp;</span> as_local_time_fmt ();
</span></span><span style=display:flex><span>array_format_info <span style=color:#f92672>&amp;</span> as_array_fmt ();
</span></span><span style=display:flex><span>table_format_info <span style=color:#f92672>&amp;</span> as_table_fmt ();
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>boolean_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_boolean_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>integer_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_integer_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>floating_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_floating_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>string_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_string_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>offset_datetime_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_offset_datetime_fmt() <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>local_datetime_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_datetime_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>local_date_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_date_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>local_time_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_time_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>array_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_array_fmt () <span style=color:#66d9ef>const</span>;
</span></span><span style=display:flex><span>table_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_table_fmt () <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-8>Return Value
<a class=anchor href=#return-value-8>#</a></h4><p>Returns a reference to the structure holding the format information for the specified type.</p><h4 id=exception-1>Exception
<a class=anchor href=#exception-1>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value&rsquo;s type does not match the specified type.</p><hr><h3 id=as_xxx_fmtstdnothrow><code>as_xxx_fmt(std::nothrow)</code>
<a class=anchor href=#as_xxx_fmtstdnothrow>#</a></h3><p>Invoke with a <code>std::nothrow</code> object.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>boolean_format_info <span style=color:#f92672>&amp;</span> as_boolean_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>integer_format_info <span style=color:#f92672>&amp;</span> as_integer_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>floating_format_info <span style=color:#f92672>&amp;</span> as_floating_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>string_format_info <span style=color:#f92672>&amp;</span> as_string_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>offset_datetime_format_info<span style=color:#f92672>&amp;</span> as_offset_datetime_fmt(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_datetime_format_info <span style=color:#f92672>&amp;</span> as_local_datetime_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_date_format_info <span style=color:#f92672>&amp;</span> as_local_date_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_time_format_info <span style=color:#f92672>&amp;</span> as_local_time_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>array_format_info <span style=color:#f92672>&amp;</span> as_array_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>table_format_info <span style=color:#f92672>&amp;</span> as_table_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>boolean_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_boolean_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>integer_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_integer_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>floating_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_floating_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>string_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_string_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>offset_datetime_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_offset_datetime_fmt(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_datetime_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_datetime_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_date_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_date_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>local_time_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_local_time_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>array_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_array_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>table_format_info <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> as_table_fmt (<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>nothrow_t<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><h4 id=return-value-9>Return Value
<a class=anchor href=#return-value-9>#</a></h4><p>Returns a reference to the structure holding the format information for the specified type.</p><h4 id=note-1>Note
<a class=anchor href=#note-1>#</a></h4><p>If the type of the stored value does not match the specified type, the behavior is undefined.</p><hr><h3 id=atkey><code>at(key)</code>
<a class=anchor href=#atkey>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> at(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> key);
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> at(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> key) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-10>Return Value
<a class=anchor href=#return-value-10>#</a></h4><p>Casts the current <code>value</code> to a <code>table</code> and returns the element specified by <code>key</code>.</p><h4 id=exception-2>Exception
<a class=anchor href=#exception-2>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value is not a <code>table</code>.</p><p>Throws <code>std::out_of_range</code> if the <code>table</code> does not contain the specified element.</p><hr><h4 id=operatorkey><code>operator[](key)</code>
<a class=anchor href=#operatorkey>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span>[](<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> k);
</span></span></code></pre></div><h5 id=return-value-11>Return Value
<a class=anchor href=#return-value-11>#</a></h5><p>Casts the current <code>value</code> to a <code>table</code> and returns a reference to the element specified by <code>key</code>.</p><p>If the element specified by <code>key</code> does not exist, it is default-constructed.</p><h5 id=exception-3>Exception
<a class=anchor href=#exception-3>#</a></h5><p>Throws <code>toml::type_error</code> if the stored value is not a <code>table</code>.</p><hr><h3 id=countkey><code>count(key)</code>
<a class=anchor href=#countkey>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t count(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> key) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-12>Return Value
<a class=anchor href=#return-value-12>#</a></h4><p>Casts the current <code>value</code> to a <code>table</code> and returns <code>1</code> if the element corresponding to <code>key</code> is present, otherwise returns <code>0</code>.</p><h4 id=exception-4>Exception
<a class=anchor href=#exception-4>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value is not a <code>table</code>.</p><hr><h3 id=containskey><code>contains(key)</code>
<a class=anchor href=#containskey>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>contains</span>(<span style=color:#66d9ef>const</span> key_type<span style=color:#f92672>&amp;</span> key) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-13>Return Value
<a class=anchor href=#return-value-13>#</a></h4><p>Casts the current <code>value</code> to a <code>table</code> and returns <code>true</code> if the element corresponding to <code>key</code> is present, otherwise returns <code>false</code>.</p><h4 id=exception-5>Exception
<a class=anchor href=#exception-5>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value is not a <code>table</code>.</p><hr><h3 id=atidx><code>at(idx)</code>
<a class=anchor href=#atidx>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> at(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t idx);
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> at(<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t idx) <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-14>Return Value
<a class=anchor href=#return-value-14>#</a></h4><p>Casts the current <code>value</code> to an <code>array</code> and returns the element specified by <code>idx</code>.</p><h4 id=exception-6>Exception
<a class=anchor href=#exception-6>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value is not an <code>array</code>.</p><p>Throws <code>std::out_of_range</code> if the specified element does not exist in the <code>array</code>.</p><hr><h3 id=operatoridx><code>operator[](idx)</code>
<a class=anchor href=#operatoridx>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span>[](<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t idx) <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>value_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span>[](<span style=color:#66d9ef>const</span> std<span style=color:#f92672>::</span>size_t idx) <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><h4 id=return-value-15>Return Value
<a class=anchor href=#return-value-15>#</a></h4><p>Casts the current <code>value</code> to an <code>array</code> and returns a reference to the element specified by <code>idx</code>.</p><h4 id=note-2>Note
<a class=anchor href=#note-2>#</a></h4><p>Performs no checks. Behavior is undefined if the stored value is not an <code>array</code> or if the specified element does not exist.</p><hr><h3 id=push_backvalue><code>push_back(value)</code>
<a class=anchor href=#push_backvalue>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>push_back</span>(<span style=color:#66d9ef>const</span> value_type<span style=color:#f92672>&amp;</span> x);
</span></span><span style=display:flex><span><span style=color:#66d9ef>void</span> <span style=color:#a6e22e>push_back</span>(value_type<span style=color:#f92672>&amp;&amp;</span> x);
</span></span></code></pre></div><p>Casts the current <code>value</code> to an <code>array</code> and performs <code>push_back</code> on the <code>array</code>.</p><h4 id=return-value-16>Return Value
<a class=anchor href=#return-value-16>#</a></h4><p>None.</p><h4 id=exception-7>Exception
<a class=anchor href=#exception-7>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value is not an <code>array</code>.</p><hr><h3 id=emplace_backargs><code>emplace_back(args...)</code>
<a class=anchor href=#emplace_backargs>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>value_type<span style=color:#f92672>&amp;</span> emplace_back(Ts<span style=color:#f92672>&amp;&amp;</span> ... args)
</span></span></code></pre></div><p>Casts the current <code>value</code> to an <code>array</code> and performs <code>emplace_back</code> on the <code>array</code>.</p><h4 id=return-value-17>Return Value
<a class=anchor href=#return-value-17>#</a></h4><p>A reference to the constructed value.</p><h4 id=exception-8>Exception
<a class=anchor href=#exception-8>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value is not an <code>array</code>.</p><hr><h3 id=size><code>size()</code>
<a class=anchor href=#size>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>size_t size() <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-18>Return Value
<a class=anchor href=#return-value-18>#</a></h4><p>Casts the current <code>value</code> to an <code>array</code>, <code>string</code>, or <code>table</code> and returns the number of elements. For a <code>string</code>, it returns the number of characters.</p><h4 id=exception-9>Exception
<a class=anchor href=#exception-9>#</a></h4><p>Throws <code>toml::type_error</code> if the stored value is not an <code>array</code>, <code>string</code>, or <code>table</code>.</p><hr><h3 id=location><code>location()</code>
<a class=anchor href=#location>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>source_location <span style=color:#a6e22e>location</span>() <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-19>Return Value
<a class=anchor href=#return-value-19>#</a></h4><p>Returns a <code>source_location</code> object representing the position within the TOML document where the <code>value</code> is defined.</p><p>If the <code>value</code> was not constructed by parsing a TOML document, returns a <code>source_location</code> that points to nowhere.</p><hr><h3 id=comments><code>comments()</code>
<a class=anchor href=#comments>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>comment_type <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> comments() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>comment_type<span style=color:#f92672>&amp;</span> comments() <span style=color:#66d9ef>noexcept</span>;
</span></span></code></pre></div><h4 id=return-value-20>Return Value
<a class=anchor href=#return-value-20>#</a></h4><p>Returns a reference to the comment container.</p><hr><h3 id=accessed><code>accessed()</code>
<a class=anchor href=#accessed>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#a6e22e>accessed</span>() <span style=color:#66d9ef>const</span>;
</span></span></code></pre></div><h4 id=return-value-21>Return Value
<a class=anchor href=#return-value-21>#</a></h4><p>Returns <code>true</code> only if the <code>value</code> has been accessed via <code>as_xxx</code> or <code>is_xxx</code>.
Otherwise, it returns <code>false</code>.</p><h4 id=remarks>Remarks
<a class=anchor href=#remarks>#</a></h4><p>It exists only when <code>TOML11_ENABLE_ACCESS_CHECK</code> is defined.</p><h2 id=non-member-functions>Non-Member Functions
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=operator><code>operator==</code>
<a class=anchor href=#operator>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>==</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span></code></pre></div><p>Two <code>basic_value&lt;T></code> instances are considered equal if they satisfy the following conditions:</p><ul><li>The contained type is the same.</li><li>The contained values are identical.</li><li>The comments are identical at the byte level.</li></ul><h3 id=operator-1><code>operator!=</code>
<a class=anchor href=#operator-1>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>!=</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> lhs, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> rhs)
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#f92672>!</span>(lhs <span style=color:#f92672>==</span> rhs);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h3 id=operator-2><code>operator&lt;</code>
<a class=anchor href=#operator-2>#</a></h3><p>Defined only if <code>array_type</code> and <code>table_type</code> have <code>operator&lt;</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span>);
</span></span></code></pre></div><p>Comparison order:</p><ol><li>TOML type</li><li>If TOML types are the same, their values</li><li>If both the TOML types and values are the same, the comments</li></ol><p>TOML types have the following order (from smallest to largest):</p><ol><li><code>toml::value_t::empty</code></li><li><code>toml::value_t::boolean</code></li><li><code>toml::value_t::integer</code></li><li><code>toml::value_t::floating</code></li><li><code>toml::value_t::string</code></li><li><code>toml::value_t::offset_datetime</code></li><li><code>toml::value_t::local_datetime</code></li><li><code>toml::value_t::local_date</code></li><li><code>toml::value_t::local_time</code></li><li><code>toml::value_t::array</code></li><li><code>toml::value_t::table</code></li></ol><h3 id=operator-3><code>operator&lt;=</code>
<a class=anchor href=#operator-3>#</a></h3><p>Defined only if <code>array_type</code> and <code>table_type</code> have <code>operator&lt;</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;=</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> lhs, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> rhs)
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> (lhs <span style=color:#f92672>&lt;</span> rhs) <span style=color:#f92672>||</span> (lhs <span style=color:#f92672>==</span> rhs);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h3 id=operator-4><code>operator></code>
<a class=anchor href=#operator-4>#</a></h3><p>Defined only if <code>array_type</code> and <code>table_type</code> have <code>operator&lt;</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> lhs, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> rhs)
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#f92672>!</span>(lhs <span style=color:#f92672>&lt;=</span> rhs);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h3 id=operator-5><code>operator>=</code>
<a class=anchor href=#operator-5>#</a></h3><p>Defined only if <code>array_type</code> and <code>table_type</code> have <code>operator&lt;</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>bool</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&gt;=</span>(<span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> lhs, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> rhs)
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#f92672>!</span>(lhs <span style=color:#f92672>&lt;</span> rhs);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h1 id=tomltype_error><code>toml::type_error</code>
<a class=anchor href=#tomltype_error>#</a></h1><p>Exception thrown in case of a type error.</p><p>Contains the location information of the value that caused the type error.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>type_error</span> <span style=color:#66d9ef>final</span> <span style=color:#f92672>:</span> <span style=color:#66d9ef>public</span> <span style=color:#f92672>::</span>toml<span style=color:#f92672>::</span>exception
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> <span style=color:#66d9ef>public</span><span style=color:#f92672>:</span>
</span></span><span style=display:flex><span> type_error(std<span style=color:#f92672>::</span>string what_arg, source_location loc);
</span></span><span style=display:flex><span> <span style=color:#f92672>~</span>type_error() <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>default</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>what</span>() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span> <span style=color:#66d9ef>override</span>;
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> source_location <span style=color:#66d9ef>const</span><span style=color:#f92672>&amp;</span> location() <span style=color:#66d9ef>const</span> <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>};
</span></span></code></pre></div><h1 id=tomlmake_error_info><code>toml::make_error_info</code>
<a class=anchor href=#tomlmake_error_info>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>error_info make_error_info(
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string title, <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, std<span style=color:#f92672>::</span>string msg, Ts<span style=color:#f92672>&amp;&amp;</span> ... tail);
</span></span></code></pre></div><p>Calls <code>location()</code> on a <code>basic_value</code>, passes the resulting <code>source_location</code> to
<a href=https://toruniina.github.io/toml11/docs/reference/error_info/#make_error_info><code>make_error_info</code></a>
to create an <code>error_info</code>.</p><p>Refer to <a href=https://toruniina.github.io/toml11/docs/reference/error_info/><code>error_info</code></a> for more details.</p><h1 id=tomlformat_error><code>toml::format_error</code>
<a class=anchor href=#tomlformat_error>#</a></h1><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> TC, <span style=color:#66d9ef>typename</span> ... Ts<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string format_error(std<span style=color:#f92672>::</span>string title,
</span></span><span style=display:flex><span> <span style=color:#66d9ef>const</span> basic_value<span style=color:#f92672>&lt;</span>TC<span style=color:#f92672>&gt;&amp;</span> v, std<span style=color:#f92672>::</span>string msg, Ts<span style=color:#f92672>&amp;&amp;</span> ... tail);
</span></span></code></pre></div><p>Calls <code>location()</code> on a <code>basic_value</code>, passes the resulting <code>source_location</code> to
<a href=https://toruniina.github.io/toml11/docs/reference/error_info/#format_error><code>format_error</code></a>
to create an <code>error_info</code>, then converts it to a string and returns it.</p><p>Refer to <a href=https://toruniina.github.io/toml11/docs/reference/error_info/><code>error_info</code></a> for more details.</p><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/types/>types.hpp</a></li><li><a href=https://toruniina.github.io/toml11/docs/reference/visit/>visit.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#valuehpp>value.hpp</a></li><li><a href=#tomlbasic_value><code>toml::basic_value</code></a><ul><li><a href=#member-types>Member Types</a></li><li><a href=#member-functions>Member Functions</a><ul><li><a href=#default-constructor>Default Constructor</a></li><li><a href=#copy-and-move-constructors>Copy and Move Constructors</a></li><li><a href=#copy-and-move-constructors-with-comments>Copy and Move Constructors with Comments</a></li><li><a href=#conversion-constructors>Conversion Constructors</a></li><li><a href=#constructor-boolean>Constructor (boolean)</a></li><li><a href=#constructor-integer>Constructor (integer)</a></li><li><a href=#constructor-floating>Constructor (floating)</a></li><li><a href=#constructor-string>Constructor (string)</a></li><li><a href=#constructor-local_date>Constructor (local_date)</a></li><li><a href=#constructor-local_time>Constructor (local_time)</a></li><li><a href=#constructor-local_datetime>Constructor (local_datetime)</a></li><li><a href=#constructor-offset_datetime>Constructor (offset_datetime)</a></li><li><a href=#constructor-array>Constructor (array)</a></li><li><a href=#constructor-table>Constructor (table)</a></li><li><a href=#constructor-user-defined>Constructor (user-defined)</a></li><li><a href=#operatorbasic_value><code>operator=(basic_value)</code></a></li><li><a href=#operatort><code>operator=(T)</code></a></li><li><a href=#ist><code>is&lt;T>()</code></a></li><li><a href=#istomlvalue_t><code>is(toml::value_t)</code></a></li><li><a href=#is_xxx><code>is_xxx()</code></a></li><li><a href=#is_empty><code>is_empty()</code></a></li><li><a href=#is_array_of_tables><code>is_array_of_tables()</code></a></li><li><a href=#type><code>type()</code></a></li><li><a href=#as_xxx><code>as_xxx()</code></a></li><li><a href=#as_xxxstdnothrow><code>as_xxx(std::nothrow)</code></a></li><li><a href=#as_xxx_fmt><code>as_xxx_fmt()</code></a></li><li><a href=#as_xxx_fmtstdnothrow><code>as_xxx_fmt(std::nothrow)</code></a></li><li><a href=#atkey><code>at(key)</code></a></li><li><a href=#countkey><code>count(key)</code></a></li><li><a href=#containskey><code>contains(key)</code></a></li><li><a href=#atidx><code>at(idx)</code></a></li><li><a href=#operatoridx><code>operator[](idx)</code></a></li><li><a href=#push_backvalue><code>push_back(value)</code></a></li><li><a href=#emplace_backargs><code>emplace_back(args...)</code></a></li><li><a href=#size><code>size()</code></a></li><li><a href=#location><code>location()</code></a></li><li><a href=#comments><code>comments()</code></a></li><li><a href=#accessed><code>accessed()</code></a></li></ul></li><li><a href=#non-member-functions>Non-Member Functions</a><ul><li><a href=#operator><code>operator==</code></a></li><li><a href=#operator-1><code>operator!=</code></a></li><li><a href=#operator-2><code>operator&lt;</code></a></li><li><a href=#operator-3><code>operator&lt;=</code></a></li><li><a href=#operator-4><code>operator></code></a></li><li><a href=#operator-5><code>operator>=</code></a></li></ul></li></ul></li><li><a href=#tomltype_error><code>toml::type_error</code></a></li><li><a href=#tomlmake_error_info><code>toml::make_error_info</code></a></li><li><a href=#tomlformat_error><code>toml::format_error</code></a></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,74 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
value_t.hpp
#
value_t
#
value_t is used to handle the type information of toml::value.
namespace toml
{
enum class value_t : std::uint8_t
{
empty = 0,
boolean = 1,
integer = 2,
floating = 3,
string = 4,
offset_datetime = 5,
local_datetime = 6,
local_date = 7,
local_time = 8,
array = 9,
table = 10
};
std::ostream& operator<<(std::ostream& os, value_t t);
std::string to_string(value_t t);
} // toml
Non-member Functions
#
Stream Operator
#
std::ostream& operator<<(std::ostream& os, value_t t);
Outputs the string representation of the value_t to the stream."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/value_t/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="value_t.hpp"><meta property="og:description" content="value_t.hpp # value_t # value_t is used to handle the type information of toml::value.
namespace toml { enum class value_t : std::uint8_t { empty = 0, boolean = 1, integer = 2, floating = 3, string = 4, offset_datetime = 5, local_datetime = 6, local_date = 7, local_time = 8, array = 9, table = 10 }; std::ostream& operator<<(std::ostream& os, value_t t); std::string to_string(value_t t); } // toml Non-member Functions # Stream Operator # std::ostream& operator<<(std::ostream& os, value_t t); Outputs the string representation of the value_t to the stream."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>value_t.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/value_t/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/value_t/ title=value_t.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/value_t/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/ class=active>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>value_t.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#value_thpp>value_t.hpp</a></li><li><a href=#value_t><code>value_t</code></a><ul><li><a href=#non-member-functions>Non-member Functions</a><ul><li><a href=#stream-operator>Stream Operator</a></li><li><a href=#to_string><code>to_string</code></a></li></ul></li></ul></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=value_thpp>value_t.hpp
<a class=anchor href=#value_thpp>#</a></h1><h1 id=value_t><code>value_t</code>
<a class=anchor href=#value_t>#</a></h1><p><code>value_t</code> is used to handle the type information of <code>toml::value</code>.</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>enum</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>value_t</span> <span style=color:#f92672>:</span> std<span style=color:#f92672>::</span><span style=color:#66d9ef>uint8_t</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> empty <span style=color:#f92672>=</span> <span style=color:#ae81ff>0</span>,
</span></span><span style=display:flex><span> boolean <span style=color:#f92672>=</span> <span style=color:#ae81ff>1</span>,
</span></span><span style=display:flex><span> integer <span style=color:#f92672>=</span> <span style=color:#ae81ff>2</span>,
</span></span><span style=display:flex><span> floating <span style=color:#f92672>=</span> <span style=color:#ae81ff>3</span>,
</span></span><span style=display:flex><span> string <span style=color:#f92672>=</span> <span style=color:#ae81ff>4</span>,
</span></span><span style=display:flex><span> offset_datetime <span style=color:#f92672>=</span> <span style=color:#ae81ff>5</span>,
</span></span><span style=display:flex><span> local_datetime <span style=color:#f92672>=</span> <span style=color:#ae81ff>6</span>,
</span></span><span style=display:flex><span> local_date <span style=color:#f92672>=</span> <span style=color:#ae81ff>7</span>,
</span></span><span style=display:flex><span> local_time <span style=color:#f92672>=</span> <span style=color:#ae81ff>8</span>,
</span></span><span style=display:flex><span> array <span style=color:#f92672>=</span> <span style=color:#ae81ff>9</span>,
</span></span><span style=display:flex><span> table <span style=color:#f92672>=</span> <span style=color:#ae81ff>10</span>
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;&lt;</span>(std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> os, value_t t);
</span></span><span style=display:flex><span>std<span style=color:#f92672>::</span>string to_string(value_t t);
</span></span><span style=display:flex><span>} <span style=color:#75715e>// toml
</span></span></span></code></pre></div><h2 id=non-member-functions>Non-member Functions
<a class=anchor href=#non-member-functions>#</a></h2><h3 id=stream-operator>Stream Operator
<a class=anchor href=#stream-operator>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> <span style=color:#66d9ef>operator</span><span style=color:#f92672>&lt;&lt;</span>(std<span style=color:#f92672>::</span>ostream<span style=color:#f92672>&amp;</span> os, value_t t);
</span></span></code></pre></div><p>Outputs the string representation of the <code>value_t</code> to the stream.</p><h3 id=to_string><code>to_string</code>
<a class=anchor href=#to_string>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span>std<span style=color:#f92672>::</span>string to_string(value_t t);
</span></span></code></pre></div><p>Returns the string representation of the <code>value_t</code>.</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#value_thpp>value_t.hpp</a></li><li><a href=#value_t><code>value_t</code></a><ul><li><a href=#non-member-functions>Non-member Functions</a><ul><li><a href=#stream-operator>Stream Operator</a></li><li><a href=#to_string><code>to_string</code></a></li></ul></li></ul></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,61 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
version.hpp
#
In version.hpp, macros related to the version information of toml11 are defined.
Macros
#
TOML11_VERSION_MAJOR
#
The major version of toml11.
TOML11_VERSION_MINOR
#
The minor version of toml11.
TOML11_VERSION_PATCH
#
The patch version of toml11.
Function
#
license_notice
#
namespace toml
{
const char* license_notice() noexcept;
}
Returns the license notice.
Provided for convenience when redistributing without source code."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/version/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="version.hpp"><meta property="og:description" content="version.hpp # In version.hpp, macros related to the version information of toml11 are defined.
Macros # TOML11_VERSION_MAJOR # The major version of toml11.
TOML11_VERSION_MINOR # The minor version of toml11.
TOML11_VERSION_PATCH # The patch version of toml11.
Function # license_notice # namespace toml { const char* license_notice() noexcept; } Returns the license notice.
Provided for convenience when redistributing without source code."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>version.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/version/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/version/ title=version.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/version/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/ class=active>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>version.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#versionhpp>version.hpp</a><ul><li><a href=#macros>Macros</a><ul><li><a href=#toml11_version_major><code>TOML11_VERSION_MAJOR</code></a></li><li><a href=#toml11_version_minor><code>TOML11_VERSION_MINOR</code></a></li><li><a href=#toml11_version_patch><code>TOML11_VERSION_PATCH</code></a></li></ul></li><li><a href=#function>Function</a><ul><li><a href=#license_notice><code>license_notice</code></a></li></ul></li></ul></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=versionhpp>version.hpp
<a class=anchor href=#versionhpp>#</a></h1><p>In <code>version.hpp</code>, macros related to the version information of toml11 are defined.</p><h2 id=macros>Macros
<a class=anchor href=#macros>#</a></h2><h3 id=toml11_version_major><code>TOML11_VERSION_MAJOR</code>
<a class=anchor href=#toml11_version_major>#</a></h3><p>The major version of toml11.</p><h3 id=toml11_version_minor><code>TOML11_VERSION_MINOR</code>
<a class=anchor href=#toml11_version_minor>#</a></h3><p>The minor version of toml11.</p><h3 id=toml11_version_patch><code>TOML11_VERSION_PATCH</code>
<a class=anchor href=#toml11_version_patch>#</a></h3><p>The patch version of toml11.</p><h2 id=function>Function
<a class=anchor href=#function>#</a></h2><h3 id=license_notice><code>license_notice</code>
<a class=anchor href=#license_notice>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>const</span> <span style=color:#66d9ef>char</span><span style=color:#f92672>*</span> <span style=color:#a6e22e>license_notice</span>() <span style=color:#66d9ef>noexcept</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>Returns the license notice.</p><p>Provided for convenience when redistributing without source code.</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#versionhpp>version.hpp</a><ul><li><a href=#macros>Macros</a><ul><li><a href=#toml11_version_major><code>TOML11_VERSION_MAJOR</code></a></li><li><a href=#toml11_version_minor><code>TOML11_VERSION_MINOR</code></a></li><li><a href=#toml11_version_patch><code>TOML11_VERSION_PATCH</code></a></li></ul></li><li><a href=#function>Function</a><ul><li><a href=#license_notice><code>license_notice</code></a></li></ul></li></ul></li></ul></nav></div></aside></main></body></html>

View File

@@ -0,0 +1,69 @@
<!doctype html><html lang=en dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="
visit.hpp
#
In visit.hpp, toml::visit is defined.
toml::visit
#
Functions
#
namespace toml
{
template<typename Visitor, typename ... Args>
/* Return value when Visitor is called with a value of basic_value<TC> */
visit(Visitor&& visitor, Args&& ... args);
}
toml::visit calls the overload of Visitor corresponding to the type held by basic_value<TC>, and returns the result.
Requirements
#
Visitor must be a function or function object callable with any type held by basic_value<TC>."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://toruniina.github.io/toml11/docs/reference/visit/"><meta property="og:site_name" content="toml11"><meta property="og:title" content="visit.hpp"><meta property="og:description" content="visit.hpp # In visit.hpp, toml::visit is defined.
toml::visit # Functions # namespace toml { template<typename Visitor, typename ... Args> /* Return value when Visitor is called with a value of basic_value<TC> */ visit(Visitor&& visitor, Args&& ... args); } toml::visit calls the overload of Visitor corresponding to the type held by basic_value<TC>, and returns the result.
Requirements # Visitor must be a function or function object callable with any type held by basic_value<TC>."><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="docs"><title>visit.hpp | toml11</title><link rel=manifest href=/toml11/manifest.json><link rel=icon href=/toml11/favicon.png><link rel=canonical href=https://toruniina.github.io/toml11/docs/reference/visit/><link rel=alternate hreflang=ja href=https://toruniina.github.io/toml11/ja/docs/reference/visit/ title=visit.hpp><link rel=stylesheet href=/toml11/book.min.6d8037b375fe949eee1b70501c5fb9478914c9c5eb3ef7696163fd3031c69421.css integrity="sha256-bYA3s3X+lJ7uG3BQHF+5R4kUycXrPvdpYWP9MDHGlCE=" crossorigin=anonymous><script defer src=/toml11/fuse.min.js></script><script defer src=/toml11/en.search.min.87bec23503963d7026bfa3a917b92707789d315c9c9e005e23226b35dce643f5.js integrity="sha256-h77CNQOWPXAmv6OpF7knB3idMVycngBeIyJrNdzmQ/U=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/toml11/><span>toml11</span></a></h2><div class="book-search hidden"><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><script>document.querySelector(".book-search").classList.remove("hidden")</script><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class="flex justify-between"><a role=button class="flex align-center"><img src=/toml11/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=https://toruniina.github.io/toml11/ja/docs/reference/visit/>日本語</a></li></ul></li></ul><ul><li><a href=/toml11/docs/installation/>installation</a><ul></ul></li><li><input type=checkbox id=section-291123c850af98d8b815ccdbb4c33657 class=toggle>
<label for=section-291123c850af98d8b815ccdbb4c33657 class="flex justify-between"><a href=/toml11/docs/features/>features</a></label><ul><li><a href=/toml11/docs/features/parsing_files/>parsing files</a></li><li><a href=/toml11/docs/features/value/>getting values</a></li><li><a href=/toml11/docs/features/error_message/>error message</a></li><li><a href=/toml11/docs/features/serialize/>serializing values</a></li><li><a href=/toml11/docs/features/configure_types/>configuring types</a></li><li><a href=/toml11/docs/features/literal/>toml literal</a></li><li><a href=/toml11/docs/features/toml_spec/>toml spec</a></li><li><a href=/toml11/docs/features/extension/>extension</a></li></ul></li><li><input type=checkbox id=section-e2e812e55021b82e114feaae98f1a02e class=toggle checked>
<label for=section-e2e812e55021b82e114feaae98f1a02e class="flex justify-between"><a href=/toml11/docs/reference/>reference</a></label><ul><li><a href=/toml11/docs/reference/color/>color.hpp</a></li><li><a href=/toml11/docs/reference/comments/>comments.hpp</a></li><li><a href=/toml11/docs/reference/conversion/>conversion.hpp</a></li><li><a href=/toml11/docs/reference/datetime/>datetime.hpp</a></li><li><a href=/toml11/docs/reference/error_info/>error_info.hpp</a></li><li><a href=/toml11/docs/reference/exception/>exception.hpp</a></li><li><a href=/toml11/docs/reference/find/>find.hpp</a></li><li><a href=/toml11/docs/reference/format/>format.hpp</a></li><li><a href=/toml11/docs/reference/from/>from.hpp</a></li><li><a href=/toml11/docs/reference/get/>get.hpp</a></li><li><a href=/toml11/docs/reference/into/>into.hpp</a></li><li><a href=/toml11/docs/reference/literal/>literal.hpp</a></li><li><a href=/toml11/docs/reference/ordered_map/>ordered_map.hpp</a></li><li><a href=/toml11/docs/reference/parser/>parser.hpp</a></li><li><a href=/toml11/docs/reference/result/>result.hpp</a></li><li><a href=/toml11/docs/reference/serializer/>serializer.hpp</a></li><li><a href=/toml11/docs/reference/source_location/>source_location.hpp</a></li><li><a href=/toml11/docs/reference/spec/>spec.hpp</a></li><li><a href=/toml11/docs/reference/toml_fwd/>toml_fwd.hpp</a></li><li><a href=/toml11/docs/reference/toml/>toml.hpp</a></li><li><a href=/toml11/docs/reference/types/>types.hpp</a></li><li><a href=/toml11/docs/reference/value_t/>value_t.hpp</a></li><li><a href=/toml11/docs/reference/value/>value.hpp</a></li><li><a href=/toml11/docs/reference/version/>version.hpp</a></li><li><a href=/toml11/docs/reference/visit/ class=active>visit.hpp</a></li></ul></li><li><a href=/toml11/docs/changelog/>changelog</a><ul></ul></li></ul><ul><li><a href=https://github.com/ToruNiina/toml11 target=_blank rel=noopener>GitHub</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/toml11/svg/menu.svg class=book-icon alt=Menu>
</label><strong>visit.hpp</strong>
<label for=toc-control><img src=/toml11/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#visithpp>visit.hpp</a></li><li><a href=#tomlvisit><code>toml::visit</code></a><ul><li><a href=#functions>Functions</a><ul><li></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=visithpp>visit.hpp
<a class=anchor href=#visithpp>#</a></h1><p>In <code>visit.hpp</code>, <code>toml::visit</code> is defined.</p><h1 id=tomlvisit><code>toml::visit</code>
<a class=anchor href=#tomlvisit>#</a></h1><h2 id=functions>Functions
<a class=anchor href=#functions>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#66d9ef>namespace</span> toml
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span><span style=color:#66d9ef>template</span><span style=color:#f92672>&lt;</span><span style=color:#66d9ef>typename</span> Visitor, <span style=color:#66d9ef>typename</span> ... Args<span style=color:#f92672>&gt;</span>
</span></span><span style=display:flex><span><span style=color:#75715e>/* Return value when Visitor is called with a value of basic_value&lt;TC&gt; */</span>
</span></span><span style=display:flex><span>visit(Visitor<span style=color:#f92672>&amp;&amp;</span> visitor, Args<span style=color:#f92672>&amp;&amp;</span> ... args);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p><code>toml::visit</code> calls the overload of <code>Visitor</code> corresponding to the type held by <code>basic_value&lt;TC></code>, and returns the result.</p><h4 id=requirements>Requirements
<a class=anchor href=#requirements>#</a></h4><p><code>Visitor</code> must be a function or function object callable with any type held by <code>basic_value&lt;TC></code>.</p><p>Additionally, the return value must be consistent across all overloads.</p><h4 id=example>Example
<a class=anchor href=#example>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cpp data-lang=cpp><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;toml.hpp&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e>#include</span> <span style=color:#75715e>&lt;iostream&gt;</span><span style=color:#75715e>
</span></span></span><span style=display:flex><span><span style=color:#75715e></span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>type_name_of</span>
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>boolean_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;boolean&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>integer_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;integer&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>floating_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;floating&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>string_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;string&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>local_time_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;local_time&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>local_date_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;local_date&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>local_datetime_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;local_datetime&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>offset_datetime_type<span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;offset_datetime&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>array_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;array&#34;</span>;}
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>string <span style=color:#66d9ef>operator</span>()(<span style=color:#66d9ef>const</span> toml<span style=color:#f92672>::</span>value<span style=color:#f92672>::</span>table_type <span style=color:#f92672>&amp;</span>) <span style=color:#66d9ef>const</span> {<span style=color:#66d9ef>return</span> <span style=color:#e6db74>&#34;table&#34;</span>;}
</span></span><span style=display:flex><span>};
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>int</span> <span style=color:#a6e22e>main</span>()
</span></span><span style=display:flex><span>{
</span></span><span style=display:flex><span> toml<span style=color:#f92672>::</span>value v(<span style=color:#ae81ff>3.14</span>);
</span></span><span style=display:flex><span> std<span style=color:#f92672>::</span>cout <span style=color:#f92672>&lt;&lt;</span> toml<span style=color:#f92672>::</span>visit(type_name_of{}, v) <span style=color:#f92672>&lt;&lt;</span> std<span style=color:#f92672>::</span>endl; <span style=color:#75715e>// floating
</span></span></span><span style=display:flex><span><span style=color:#75715e></span> <span style=color:#66d9ef>return</span> <span style=color:#ae81ff>0</span>;
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><h1 id=related>Related
<a class=anchor href=#related>#</a></h1><ul><li><a href=https://toruniina.github.io/toml11/docs/reference/value/>value.hpp</a></li></ul></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#visithpp>visit.hpp</a></li><li><a href=#tomlvisit><code>toml::visit</code></a><ul><li><a href=#functions>Functions</a><ul><li></li></ul></li></ul></li><li><a href=#related>Related</a></li></ul></nav></div></aside></main></body></html>