
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>URI - Proposed Wording (Revision 5)</title>
    
    <style type="text/css">
.highlight .hll { background-color: #ffffcc }
/* .highlight  { background: #eeffcc; } */
.highlight  { background: #fff; }
.highlight .c { color: #408090; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #007020 } /* Comment.Preproc */
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
.highlight .go { color: #303030 } /* Generic.Output */
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #0040D0 } /* Generic.Traceback */
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #007020 } /* Keyword.Pseudo */
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #902000 } /* Keyword.Type */
.highlight .m { color: #208050 } /* Literal.Number */
.highlight .s { color: #4070a0 } /* Literal.String */
.highlight .na { color: #4070a0 } /* Name.Attribute */
.highlight .nb { color: #007020 } /* Name.Builtin */
.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
.highlight .no { color: #60add5 } /* Name.Constant */
.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #007020 } /* Name.Exception */
.highlight .nf { color: #06287e } /* Name.Function */
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #bb60d5 } /* Name.Variable */
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #208050 } /* Literal.Number.Float */
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
.highlight .sc { color: #4070a0 } /* Literal.String.Char */
.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
.highlight .sx { color: #c65d09 } /* Literal.String.Other */
.highlight .sr { color: #235388 } /* Literal.String.Regex */
.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */

body {
   font-family: sans-serif;
   margin: 1em;
   max-width : 8.5in;
}

/* -- main layout ----------------------------------------------------------- */

div.clearer {
    clear: both;
}

img {
    border: 0;
}

/* -- search page ----------------------------------------------------------- */

ul.search {
    margin: 10px 0 0 20px;
    padding: 0;
}

ul.search li {
    padding: 5px 0 5px 20px;
    background-image: url(file.png);
    background-repeat: no-repeat;
    background-position: 0 7px;
}

ul.search li a {
    font-weight: bold;
}

ul.search li div.context {
    color: #888;
    margin: 2px 0 0 30px;
    text-align: left;
}

ul.keywordmatches li.goodmatch a {
    font-weight: bold;
}

/* -- index page ------------------------------------------------------------ */

table.contentstable {
    width: 90%;
}

table.contentstable p.biglink {
    line-height: 150%;
}

a.biglink {
    font-size: 1.3em;
}

span.linkdescr {
    font-style: italic;
    padding-top: 5px;
    font-size: 90%;
}

/* -- general index --------------------------------------------------------- */

table.indextable {
    width: 100%;
}

table.indextable td {
    text-align: left;
    vertical-align: top;
}

table.indextable dl, table.indextable dd {
    margin-top: 0;
    margin-bottom: 0;
}

table.indextable tr.pcap {
    height: 10px;
}

table.indextable tr.cap {
    margin-top: 10px;
    background-color: #f2f2f2;
}

img.toggler {
    margin-right: 3px;
    margin-top: 3px;
    cursor: pointer;
}

div.modindex-jumpbox {
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    margin: 1em 0 1em 0;
    padding: 0.4em;
}

div.genindex-jumpbox {
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    margin: 1em 0 1em 0;
    padding: 0.4em;
}

/* -- general body styles --------------------------------------------------- */

a.headerlink {
    visibility: hidden;
}

h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink {
    visibility: visible;
}

div.body p.caption {
    text-align: inherit;
}

div.body td {
    text-align: left;
}

.field-list ul {
    padding-left: 1em;
}

.first {
    margin-top: 0 !important;
}

p.rubric {
    margin-top: 30px;
    font-weight: bold;
}

img.align-left, .figure.align-left, object.align-left {
    clear: left;
    float: left;
    margin-right: 1em;
}

img.align-right, .figure.align-right, object.align-right {
    clear: right;
    float: right;
    margin-left: 1em;
}

img.align-center, .figure.align-center, object.align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.align-left {
    text-align: left;
}

.align-center {
    text-align: center;
}

.align-right {
    text-align: right;
}

/* -- topics ---------------------------------------------------------------- */

div.topic {
    border: 1px solid #ccc;
    padding: 7px 7px 0 7px;
    margin: 10px 0 10px 0;
}

p.topic-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 10px;
}

/* -- admonitions ----------------------------------------------------------- */

div.admonition {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 7px;
    background-color: yellow;
}

div.admonition dt {
    font-weight: bold;
}

div.admonition dl {
    margin-bottom: 0;
}

p.admonition-title {
    margin: 0px 10px 5px 0px;
    font-weight: bold;
}

div.body p.centered {
    text-align: center;
    margin-top: 25px;
}

/* -- tables ---------------------------------------------------------------- */

table.docutils {
    border: 0;
    border-collapse: collapse;
}

table.docutils td, table.docutils th {
    padding: 1px 8px 1px 5px;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid #aaa;
}

table.field-list td, table.field-list th {
    border: 0 !important;
}

table.footnote td, table.footnote th {
    border: 0 !important;
}

th {
    text-align: left;
    padding-right: 5px;
}

table.citation {
    border-left: solid 1px gray;
    margin-left: 1px;
}

table.citation td {
    border-bottom: none;
}

/* -- other body styles ----------------------------------------------------- */

ol.arabic {
    list-style: decimal;
}

ol.loweralpha {
    list-style: lower-alpha;
}

ol.upperalpha {
    list-style: upper-alpha;
}

ol.lowerroman {
    list-style: lower-roman;
}

ol.upperroman {
    list-style: upper-roman;
}

dl {
    margin-bottom: 15px;
}

dd p {
    margin-top: 0px;
}

dd ul, dd table {
    margin-bottom: 10px;
}

dd {
    margin-top: 3px;
    margin-bottom: 10px;
    margin-left: 30px;
}

dt:target, .highlighted {
    background-color: #fbe54e;
}

dl.glossary dt {
    font-weight: bold;
    font-size: 1.1em;
}

.field-list ul {
    margin: 0;
    padding-left: 1em;
}

.field-list p {
    margin: 0;
}

.refcount {
    color: #060;
}

.optional {
    font-size: 1.3em;
}

.versionmodified {
    font-style: italic;
}

.system-message {
    background-color: #fda;
    padding: 5px;
    border: 3px solid red;
}

.footnote:target  {
    background-color: #ffa;
}

.line-block {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
}

.line-block .line-block {
    margin-top: 0;
    margin-bottom: 0;
    margin-left: 1.5em;
}

.guilabel, .menuselection {
    font-family: sans-serif;
}

.accelerator {
    text-decoration: underline;
}

.classifier {
    font-style: oblique;
}

abbr, acronym {
    border-bottom: dotted 1px;
    cursor: help;
}

/* -- code displays --------------------------------------------------------- */

pre  { padding: 5px; background: #eeffcc; }

pre {
    overflow: auto;
    overflow-y: hidden;  /* fixes display issues on Chrome browsers */
}

td.linenos pre {
    padding: 5px 0px;
    border: 0;
    background-color: transparent;
    color: #aaa;
}

table.highlighttable {
    margin-left: 0.5em;
}

table.highlighttable td {
    padding: 0 0.5em 0 0.5em;
}

tt.descname {
    background-color: transparent;
    font-weight: bold;
    font-size: 1.2em;
}

tt.descclassname {
    background-color: transparent;
}

tt.xref, a tt {
    background-color: transparent;
    font-weight: bold;
}

h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
    background-color: transparent;
}

.viewcode-link {
    float: right;
}

.viewcode-back {
    float: right;
    font-family: sans-serif;
}

div.viewcode-block:target {
    margin: -1px -10px;
    padding: 0 10px;
}

/* -- math display ---------------------------------------------------------- */

img.math {
    vertical-align: middle;
}

div.body div.math p {
    text-align: center;
}

span.eqno {
    float: right;
}

/* -- printout stylesheet --------------------------------------------------- */

@media print {
    div.document,
    div.documentwrapper,
    div.bodywrapper {
        margin: 0 !important;
        width: 100%;
    }

    div.related,
    div.footer,
    #top-link {
        display: none;
    }
}
    </style>
    <link rel="top" title="None" href="index.html#document-index" /> 
  </head>
  <body>

    <div class="document">
      <div class="documentwrapper">
          <div class="body">
            
  <span class="target" id="index"></span><div class="section" id="uri-proposed-wording-revision-5">
<h1>URI - Proposed Wording (Revision 5)<a class="headerlink" href="#uri-proposed-wording-revision-5" title="Permalink to this headline">¶</a></h1>
<div class="line-block">
<div class="line"><strong>Document Number</strong>: N3975</div>
<div class="line"><strong>Revises</strong>: N3947</div>
<div class="line"><strong>Date</strong>: 2014-05-22</div>
<div class="line"><strong>Authors</strong>: Glyn Matthews &lt;<a class="reference external" href="mailto:glyn&#46;matthews&#37;&#52;&#48;gmail&#46;com">glyn<span>&#46;</span>matthews<span>&#64;</span>gmail<span>&#46;</span>com</a>&gt;, Dean Michael Berris &lt;<a class="reference external" href="mailto:dberris&#37;&#52;&#48;google&#46;com">dberris<span>&#64;</span>google<span>&#46;</span>com</a>&gt;</div>
</div>
<div class="toctree-wrapper compound">
<span id="document-introduction"></span><div class="section" id="introduction">
<span id="id1"></span><h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Notes highlighted in yellow are comments on the proposed wording
and are not intended for the actual TS.</p>
</div>
</div>
<div class="section" id="revisions-to-n3947">
<h2>Revisions to N3947<a class="headerlink" href="#revisions-to-n3947" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Numerous updates to wording and style to make it more compatible
with the standard document.</li>
<li>Removed <tt class="docutils literal"><span class="pre">string_type</span></tt> member typedef for the <tt class="docutils literal"><span class="pre">uri</span></tt> class.</li>
<li>Improved specification of the definition of port
[<a class="reference external" href="#port-uri-definition-port">uri.definition.port</a>].</li>
<li>Updated [<a class="reference external" href="index.html#requirements-uri-requirements">uri.requirements</a>] to
be the same as the filesystem proposal.</li>
<li>Renamed <tt class="docutils literal"><span class="pre">uri_error_code</span></tt> to <tt class="docutils literal"><span class="pre">uri_errc</span></tt> [<a class="reference external" href="index.html#enum-class-uri-errc-class-uri-errc">class.uri_errc</a>].</li>
<li>Added an additional sentence in [<a class="reference external" href="#scope-uri-scope">uri.scope</a>]
to describe the <tt class="docutils literal"><span class="pre">uri_errc</span></tt> <tt class="docutils literal"><span class="pre">enum</span></tt>.</li>
<li>Made member functions <tt class="docutils literal"><span class="pre">constexpr</span></tt> and <tt class="docutils literal"><span class="pre">noexcept</span></tt>, where
appropriate.</li>
<li>Improved specification of equality and comparison operators
[<a class="reference external" href="#equality-and-comparison-operators-uri-header-synopsis-equality-comparison">uri.header-synopsis.equality-comparison</a>].</li>
<li>Added a section describing uri encoding conversions
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>]</li>
<li>Added some sentences on <tt class="docutils literal"><span class="pre">make_error_code</span></tt>,
<tt class="docutils literal"><span class="pre">make_error_condition</span></tt> and <tt class="docutils literal"><span class="pre">uri_category</span></tt>
[<a class="reference external" href="#error-handling-uri-header-synopsis-error-handling">uri.header-synopsis.error-handling</a>].</li>
<li>Updated <tt class="docutils literal"><span class="pre">uri_builder</span></tt>.</li>
<li>Improved specification for <tt class="docutils literal"><span class="pre">to_uri</span></tt> and <tt class="docutils literal"><span class="pre">to_filesystem_path</span></tt> to
handle the case where the URI or filesystem path is relative
[<a class="reference external" href="#interoperability-with-std-experimental-filesystem-path-uri-header-synopsis-filesystem-interop">uri.header-synopsis.filesystem-interop</a>].</li>
</ol>
</div>
<div class="section" id="revisions-to-n3827">
<h2>Revisions to N3827<a class="headerlink" href="#revisions-to-n3827" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Reverted normalization invariant and added the <tt class="docutils literal"><span class="pre">normalize</span></tt> member
function and <tt class="docutils literal"><span class="pre">uri_normalization_level</span></tt> again.</li>
<li>Added functions for interoperability with
<tt class="docutils literal"><span class="pre">std::filesystem::path</span></tt>.</li>
<li>Replaced multiple exception classes with a single exception class,
<tt class="docutils literal"><span class="pre">uri_error</span></tt>. The <tt class="docutils literal"><span class="pre">uri_error</span></tt> enum has become
<tt class="docutils literal"><span class="pre">uri_error_code</span></tt>.</li>
<li>Updated <tt class="docutils literal"><span class="pre">make_relative</span></tt> and <tt class="docutils literal"><span class="pre">resolve</span></tt> sections.</li>
<li>Removed references to IETF RFC 2732, which, it was pointed out, is
superseded by IETF RFC 3986.</li>
</ol>
</div>
<div class="section" id="revisions-to-n3792">
<h2>Revisions to N3792<a class="headerlink" href="#revisions-to-n3792" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Normalization is now an invariant of the <tt class="docutils literal"><span class="pre">std::experimental::uri</span></tt>
class.</li>
<li>Removed <tt class="docutils literal"><span class="pre">uri_normalization_level</span></tt>.</li>
<li>Removed <tt class="docutils literal"><span class="pre">normalize</span></tt> member function.</li>
</ol>
</div>
<div class="section" id="revisions-to-n3720">
<h2>Revisions to N3720<a class="headerlink" href="#revisions-to-n3720" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Added an &#8220;Error Reporting&#8221; section.</li>
<li>Renamed &#8220;Alloc&#8221; to &#8220;Allocator&#8221; to bring it more in to line with the
standard.</li>
<li>Renamed <tt class="docutils literal"><span class="pre">uri::make_reference</span></tt> to <tt class="docutils literal"><span class="pre">uri::make_relative</span></tt>.</li>
<li>Renamed <tt class="docutils literal"><span class="pre">uri_comparison_level</span></tt> to <tt class="docutils literal"><span class="pre">uri_normalization_level</span></tt>.</li>
<li>Added sections for <tt class="docutils literal"><span class="pre">uri_error</span></tt> and <tt class="docutils literal"><span class="pre">uri_normalization_level</span></tt>.</li>
<li>Added a <tt class="docutils literal"><span class="pre">base_uri_error</span></tt> that can be thrown by the <tt class="docutils literal"><span class="pre">resolve</span></tt>
and <tt class="docutils literal"><span class="pre">make_relative</span></tt> member functions in the event that the base
URI is not valid.</li>
<li>Improved documentation of URI resolution in the Terms and
Definition section and in the description of the <tt class="docutils literal"><span class="pre">resolve</span></tt> member
functions.</li>
<li>Using the standard hash specialization instead of <tt class="docutils literal"><span class="pre">hash_value</span></tt>.</li>
<li>Allowed the <tt class="docutils literal"><span class="pre">Source</span></tt> template argument to be
<tt class="docutils literal"><span class="pre">basic_string_view&lt;CharT,</span> <span class="pre">CharTraits&gt;</span></tt></li>
<li><tt class="docutils literal"><span class="pre">uri_builder</span></tt> now allows copy and move.</li>
<li>All constructors that accept an argument of type <tt class="docutils literal"><span class="pre">Source</span></tt> now
also take <tt class="docutils literal"><span class="pre">InputIterator</span></tt> overloads.</li>
<li>Fixed minor typographical errors.</li>
</ol>
</div>
<span id="document-scope"></span><div class="section" id="scope-uri-scope">
<span id="scope"></span><h2>1 Scope [uri.scope]<a class="headerlink" href="#scope-uri-scope" title="Permalink to this headline">¶</a></h2>
<p>The scope of this Technical Specification will include a single
<tt class="docutils literal"><span class="pre">std::experimental::uri</span></tt> type, specifications about how the are
intended to be processed and extended, including some additional
helper types and functions. It will include a
<tt class="docutils literal"><span class="pre">std::experimental::uri_builder</span></tt> type to build a URI from its
components. It will also include a <tt class="docutils literal"><span class="pre">std::experimental::uri_errc</span></tt>
<tt class="docutils literal"><span class="pre">enum</span></tt> which enumerates the types of error that can occur when
parsing, normalizing, resolving or building a URI, or percent
decoding. Finally, it will include types and functions for percent
encoding and decoding, URI references, reference resolution and URI
normalization and comparison.</p>
</div>
<span id="document-conformance"></span><div class="section" id="conformance-uri-conformance">
<span id="conformance"></span><h2>2 Conformance [uri.conformance]<a class="headerlink" href="#conformance-uri-conformance" title="Permalink to this headline">¶</a></h2>
<div class="section" id="generic-syntax-uri-conformance-generic-syntax">
<h3>2.1 Generic syntax [uri.conformance.generic-syntax]<a class="headerlink" href="#generic-syntax-uri-conformance-generic-syntax" title="Permalink to this headline">¶</a></h3>
<p>The generic syntax of a URI is defined in IETF RFC 3986. section 3.</p>
<p>All URIs are of the form:</p>
<div class="highlight-python"><div class="highlight"><pre>scheme &quot;:&quot; &quot;hierarchical part&quot; [ &quot;?&quot; query ] [ &quot;#&quot; fragment ]
</pre></div>
</div>
<p>The scheme is used to identify the specification needed to parse the
rest of the URI. A generic syntax parser can parse any URI into its
main parts. The scheme can then be used to identify whether further
scheme-specific parsing can be performed.</p>
<p>The hierarchical part refers to the part of the URI that holds
identification information that is hierarchical in nature. This may
contain an authority (always prefixed with a double slash character
(&#8220;//&#8221;)) and/or a path. The path part is required, thought it may be
empty. The authority part holds an optional user info part, ending
with an at character (&#8220;&#64;&#8221;); a host identifier and an optional port
number, preceded by a colon character(&#8221;:&#8221;). The host may be an IP
address or domain name. The normative reference for IPv6 addresses is
IETF RFC 3986.</p>
<p>The query is an optional part following a question mark character
(&#8221;?&#8221;) that contains information that is not hierarchical.</p>
<p>Finally, the fragment is an optional part, prefixed by a hash
character (&#8220;#&#8221;) that is used to identify secondary sources.</p>
<p>IETF RFC 3987 specifies a new protocol element, the Internationalized
Resource Identifier (IRI). The IRI complements a URI, and extends it
to allow unicode characters. The syntax of an IRI is specified in IETF
RFC 3987, section 2.</p>
<p>IETF RFC 6874 specifies scoped IDs in IPv6 addresses. The syntax is
specified in IETF RFC 6874, section 2.</p>
</div>
<div class="section" id="uri-normalization-and-comparison-uri-conformance-uri-normalization-and-comparison">
<h3>2.2 URI Normalization and Comparison [uri.conformance.uri-normalization-and-comparison]<a class="headerlink" href="#uri-normalization-and-comparison-uri-conformance-uri-normalization-and-comparison" title="Permalink to this headline">¶</a></h3>
<p>The rules for URI normalization are specified in IETF RFC 3986,
section 6 and IETF RFC 3987, section 5.</p>
</div>
<div class="section" id="uri-references-uri-conformance-uri-references">
<h3>2.3 URI References [uri.conformance.uri-references]<a class="headerlink" href="#uri-references-uri-conformance-uri-references" title="Permalink to this headline">¶</a></h3>
<p>The rule for transforming references is given in IETF RFC 3986,
section 5.2.2.</p>
</div>
<div class="section" id="removing-dot-segments-uri-conformance-removing-dot-segments">
<h3>2.4 Removing Dot Segments [uri.conformance.removing-dot-segments]<a class="headerlink" href="#removing-dot-segments-uri-conformance-removing-dot-segments" title="Permalink to this headline">¶</a></h3>
<p>The rule for removing dot segments is given in IETF RFC 3986, section
5.2.4.</p>
</div>
<div class="section" id="uri-recomposition-uri-conformance-uri-recomposition">
<h3>2.5 URI Recomposition [uri.conformance.uri-recomposition]<a class="headerlink" href="#uri-recomposition-uri-conformance-uri-recomposition" title="Permalink to this headline">¶</a></h3>
<p>The rule for recomposing a URI from its parts is given in IETF RFC
3986, section 5.3.</p>
</div>
</div>
<span id="document-terms_and_definitions"></span><div class="section" id="terms-and-definitions-uri-definitions">
<span id="terms-and-definitions"></span><h2>3 Terms and Definitions [uri.definitions]<a class="headerlink" href="#terms-and-definitions-uri-definitions" title="Permalink to this headline">¶</a></h2>
<div class="section" id="uri-uri-definition-uri">
<h3>3.1 URI [uri.definition.uri]<a class="headerlink" href="#uri-uri-definition-uri" title="Permalink to this headline">¶</a></h3>
<p>A Uniform Resource Identifier is a sequence of characters from a
limited set with a specific syntax used to identify a name or
resource. URIs can be classified as URLs or URNs. The URI syntax is
defined in IETF RFC 3986.</p>
</div>
<div class="section" id="url-uri-definition-url">
<h3>3.2 URL [uri.definition.url]<a class="headerlink" href="#url-uri-definition-url" title="Permalink to this headline">¶</a></h3>
<p>A Uniform Resource Locator (URL) is a type of URI, complementary to a
URN used to locate a resource over a network.</p>
</div>
<div class="section" id="urn-uri-definition-urn">
<h3>3.3 URN [uri.definition.urn]<a class="headerlink" href="#urn-uri-definition-urn" title="Permalink to this headline">¶</a></h3>
<p>A Uniform Resource Name (URN) is a type of URI, complementary to a URL
used to unambiguously identify resources.</p>
</div>
<div class="section" id="iri-uri-definition-iri">
<h3>3.4 IRI [uri.definition.iri]<a class="headerlink" href="#iri-uri-definition-iri" title="Permalink to this headline">¶</a></h3>
<p>An Internationalized Resource Identifier (IRI) is a complement to the
URI that allows characters from the Universal Character Set
(Unicode/ISO 10646). The IRI syntax is defined in IETF RFC 3987.</p>
</div>
<div class="section" id="uri-part-uri-definition-uri-part">
<h3>3.5 URI Part [uri.definition.uri-part]<a class="headerlink" href="#uri-part-uri-definition-uri-part" title="Permalink to this headline">¶</a></h3>
<p>A generic URI is decomposed into four principal parts: the scheme, the
hierarchical part, an optional query and optional fragment. The
hierarchical part can be further decomposed into four parts: the user
info, host, port and path.</p>
</div>
<div class="section" id="scheme-uri-definition-scheme">
<h3>3.6 Scheme [uri.definition.scheme]<a class="headerlink" href="#scheme-uri-definition-scheme" title="Permalink to this headline">¶</a></h3>
<p>A scheme name is the top level of the URI naming structure. It
indicates the specifications, syntax and semantics of the rest of the
URI structure. It is always followed by a colon character (&#8221;:&#8221;). The
scheme syntax is defined in IETF RFC 3986, section 3.1.</p>
</div>
<div class="section" id="query-uri-definition-query">
<h3>3.7 Query [uri.definition.query]<a class="headerlink" href="#query-uri-definition-query" title="Permalink to this headline">¶</a></h3>
<p>A query is a part, indicated by a question mark character (&#8221;?&#8221;) and
terminated by a hash character (&#8220;#&#8221;), that contains non-hierarchical
information. It is commonly structured as a sequence of key-value
parameter values separated by equals (&#8220;=&#8221;), which are separated by a
semi-colon character (&#8221;;&#8221;) or ampersand character (&#8220;&amp;&#8221;). The query
syntax is defined in IETF RFC 3986, section 3.4.</p>
</div>
<div class="section" id="fragment-uri-definition-fragment">
<h3>3.8 Fragment [uri.definition.fragment]<a class="headerlink" href="#fragment-uri-definition-fragment" title="Permalink to this headline">¶</a></h3>
<p>A fragment is indicated by a hash character (&#8220;#&#8221;) and allows indirect
identification of a secondary resource. For example, a fragment may
refer to a section header in an HTML document with an id attribute of
the same name. The fragment syntax is defined in IETF RFC 3986,
section 3.5.</p>
</div>
<div class="section" id="hierarchical-part-uri-definition-hierarchical-part">
<h3>3.9 Hierarchical Part [uri.definition.hierarchical-part]<a class="headerlink" href="#hierarchical-part-uri-definition-hierarchical-part" title="Permalink to this headline">¶</a></h3>
<p>The hierarchical part of a URI contains hierarchical information. If
it starts with two consecutive forward slash characters (&#8220;//&#8221;), it is
followed by an authority and a path. The authority can be further
broken down into a user-information part, a hostname and a port. The
authority is followed by an optional path. If the hierarchical part
does not begin with two consecutive forward slash characters (&#8220;//&#8221;),
then it contains a path.</p>
</div>
<div class="section" id="authority-uri-definition-authority">
<h3>3.10 Authority [uri.definition.authority]<a class="headerlink" href="#authority-uri-definition-authority" title="Permalink to this headline">¶</a></h3>
<p>The hierarchical part contains an authority. The authority contains an
optional user info followed by an at character (&#8220;&#64;&#8221;), a host and an
optional port, preceded by a colon character (&#8221;:&#8221;). The authority
syntax is defined in IETF RFC 3986, section 3.2.</p>
</div>
<div class="section" id="user-info-uri-definition-user-info">
<h3>3.11 User Info [uri.definition.user-info]<a class="headerlink" href="#user-info-uri-definition-user-info" title="Permalink to this headline">¶</a></h3>
<p>The user info is an optional part of the URI authority, terminated by
an at character (&#8220;&#64;&#8221;) and is followed by a host. It is used in the
telnet scheme:</p>
<div class="highlight-python"><div class="highlight"><pre>telnet://&lt;user&gt;:&lt;password&gt;@&lt;host&gt;:&lt;port&gt;/
</pre></div>
</div>
<p>The user info syntax is defined in IETF RFC 3986, section 3.2.1.</p>
</div>
<div class="section" id="host-uri-definition-host">
<h3>3.12 Host [uri.definition.host]<a class="headerlink" href="#host-uri-definition-host" title="Permalink to this headline">¶</a></h3>
<p>The hostname contains a domain name or IP address. The host syntax is
defined in IETF RFC 3986, section 3.2.2.</p>
</div>
<div class="section" id="domain-name-uri-definition-domain-name">
<h3>3.13 Domain Name [uri.definition.domain-name]<a class="headerlink" href="#domain-name-uri-definition-domain-name" title="Permalink to this headline">¶</a></h3>
<p>A domain name is human-readable string used to identify a host. Domain
names are registered in the Domain Name System (DNS).</p>
</div>
<div class="section" id="ip-address-uri-definition-ip-address">
<h3>3.14 IP Address [uri.definition.ip-address]<a class="headerlink" href="#ip-address-uri-definition-ip-address" title="Permalink to this headline">¶</a></h3>
<p>The IP address can either be an IPv4 (e.g. <tt class="docutils literal"><span class="pre">127.0.0.1</span></tt>) or an IPv6
address (e.g. <tt class="docutils literal"><span class="pre">::1</span></tt>. In a URI, an IPv6 address is enclosed in square
brace characters (&#8220;[]&#8221;).</p>
</div>
<div class="section" id="port-uri-definition-port">
<h3>3.15 Port [uri.definition.port]<a class="headerlink" href="#port-uri-definition-port" title="Permalink to this headline">¶</a></h3>
<p>The optional port is a non-negative integer value, always preceded by
a colon character (&#8221;:&#8221;). If the port is not present, even if a colon
is present, then the port is considered to have the value of the
default port of the scheme. The port syntax is defined in IETF RFC
3986, section 3.2.3.</p>
</div>
<div class="section" id="path-uri-definition-path">
<h3>3.16 Path [uri.definition.path]<a class="headerlink" href="#path-uri-definition-path" title="Permalink to this headline">¶</a></h3>
<p>The path is a part of the hierarchical data and is a sequence of
segments, each separated by a forward slash character (&#8220;/&#8221;). It is
terminated by a question mark character (&#8221;?&#8221;), followed by a query, a
hash character (&#8220;#&#8221;) followed by a fragment or by the end of the
URI. The path syntax is defined in IETF RFC 3986, section 3.3.</p>
</div>
<div class="section" id="dot-segments-uri-definition-dot-segments">
<h3>3.17 Dot Segments [uri.definition.dot-segments]<a class="headerlink" href="#dot-segments-uri-definition-dot-segments" title="Permalink to this headline">¶</a></h3>
<p>Dot segments are elements in a path containing either a dot character
(&#8221;.&#8221;) or two consecutive dot characters (&#8221;..&#8221;), separated by a forward
slash character (&#8220;/&#8221;). Dot segments can be removed from a path as part
of its normalization without changing the URI semantics.</p>
</div>
<div class="section" id="absolute-uri-uri-definition-absolute-uri">
<h3>3.18 Absolute URI [uri.definition.absolute-uri]<a class="headerlink" href="#absolute-uri-uri-definition-absolute-uri" title="Permalink to this headline">¶</a></h3>
<p>An absolute URI always specifies the scheme. URIs that don&#8217;t provide
the scheme are called relative references.</p>
</div>
<div class="section" id="opaque-uri-uri-definition-opaque-uri">
<h3>3.19 Opaque URI [uri.definition.opaque-uri]<a class="headerlink" href="#opaque-uri-uri-definition-opaque-uri" title="Permalink to this headline">¶</a></h3>
<p>An opaque URI is an absolute URI that does not provide two consecutive
forward slash characters (&#8220;//&#8221;) after the scheme-delimiting colon
character (&#8221;:&#8221;). Opaque URIs have no authority and the part
immediately following the colon character (&#8221;:&#8221;) is the path. Some
examples of opaque URIs are:</p>
<div class="highlight-python"><div class="highlight"><pre>mailto:john.doe@example.com
news:comp.lang.c++
</pre></div>
</div>
<p>URIs that provide two consecutive forward slash characters (&#8220;//&#8221;)
following the scheme-delimiting colon character (&#8221;:&#8221;) are known as
hierarchical URIs. Some examples are:</p>
<div class="highlight-python"><div class="highlight"><pre>http://www.example.com/
ftp://john.doe@ftp.example.com/
</pre></div>
</div>
</div>
<div class="section" id="normalization-uri-definition-normalization">
<h3>3.20 Normalization [uri.definition.normalization]<a class="headerlink" href="#normalization-uri-definition-normalization" title="Permalink to this headline">¶</a></h3>
<p>URI normalization is the process by which a URI is transformed in
order to determine of two URIs are equivalent. There are different
levels to comparison, which trade-off the number of false negatives
and complexity. The normalization and comparison procedures are
defined in IETF RFC 3986, section 6.</p>
</div>
<div class="section" id="comparison-ladder-uri-definition-comparison-ladder">
<h3>3.21 Comparison Ladder [uri.definition.comparison-ladder]<a class="headerlink" href="#comparison-ladder-uri-definition-comparison-ladder" title="Permalink to this headline">¶</a></h3>
<p>The comparison ladder describes how URIs can be compared using
normalization in different ways, trading off the complexity of the
method and the number of false negatives. The comparison ladder is
defined in IETF RFC 3986, section 6.2 and IETF RFC 3987, section 5.3.</p>
</div>
<div class="section" id="base-uri-uri-definition-base-uri">
<h3>3.22 Base URI [uri.definition.base-uri]<a class="headerlink" href="#base-uri-uri-definition-base-uri" title="Permalink to this headline">¶</a></h3>
<p>A base URI is required to be established in order for relative
references to be usable. The specification for establishing a base URI
is defined in IETF RFC 3986, section 5.1. The base URI can also be
used as the basis for building URIs.</p>
</div>
<div class="section" id="relative-reference-uri-definition-relative-reference">
<h3>3.23 Relative Reference [uri.definition.relative-reference]<a class="headerlink" href="#relative-reference-uri-definition-relative-reference" title="Permalink to this headline">¶</a></h3>
<p>Relative references are URIs that do not provide a scheme. Relative
references are only usable when a base URI is known, against which the
relative reference can be resolved. The relative reference is defined
in IETF RFC 3986, section 4.2 and IETF RFC 3987, section 6.5.</p>
</div>
<div class="section" id="reference-resolution-uri-definition-reference-resolution">
<h3>3.24 Reference Resolution [uri.definition.reference-resolution]<a class="headerlink" href="#reference-resolution-uri-definition-reference-resolution" title="Permalink to this headline">¶</a></h3>
<p>Relative references can be resolved against a base URI, producing an
absolute URI. Only the scheme is required to be present in the base
URI. Reference resolution is defined in IETF RFC 3986, section 5.</p>
<p>Pre-parsing and normalization of the URI is performed before
transforming the reference.</p>
<p>The transform reference for resolving URIs is given in IETF RFC 3986,
section 5.2.2.</p>
</div>
<div class="section" id="percent-encoding-uri-definition-percent-encoding">
<h3>3.25 Percent Encoding [uri.definition.percent-encoding]<a class="headerlink" href="#percent-encoding-uri-definition-percent-encoding" title="Permalink to this headline">¶</a></h3>
<p>Percent encoding is the mechanism used to encode reserved characters
in a URI. See IETF RFC 3986, section 2.1.</p>
</div>
<div class="section" id="case-normalization-uri-definition-case-normalization">
<h3>3.26 Case Normalization [uri.definition.case-normalization]<a class="headerlink" href="#case-normalization-uri-definition-case-normalization" title="Permalink to this headline">¶</a></h3>
<p>All characters in a URI scheme and host are lower-case. All
hexidecimal digits within a percent-encoded triplet are
upper-case. See IETF RFC 3986, section 6.2.2.1 and IETF RFC 3987,
section 5.3.2.1.</p>
</div>
<div class="section" id="percent-encoding-normalization-uri-definition-percent-encoding-normalization">
<h3>3.27 Percent Encoding Normalization [uri.definition.percent-encoding-normalization]<a class="headerlink" href="#percent-encoding-normalization-uri-definition-percent-encoding-normalization" title="Permalink to this headline">¶</a></h3>
<p>URIs should be normalized by decoding any percent-encoded octet that
corresponds to a an unreserved character. See IETF RFC 3986, section
6.2.2.2 and IETF RFC 3987, section 5.3.2.3.</p>
</div>
<div class="section" id="path-segment-normalization-uri-definition-path-segment-normalization">
<h3>3.28 Path Segment Normalization [uri.definition.path-segment-normalization]<a class="headerlink" href="#path-segment-normalization-uri-definition-path-segment-normalization" title="Permalink to this headline">¶</a></h3>
<p>Path segments [uri.definition.dot-segments] should be removed from
URIs that are not relative references. See IETF RFC 3986, section
6.2.2.3 and IETF RFC 3987, section 5.3.2.4.</p>
</div>
<div class="section" id="character-normalization-uri-definition-character-normalization">
<h3>3.29 Character Normalization [uri.definition.character-normalization]<a class="headerlink" href="#character-normalization-uri-definition-character-normalization" title="Permalink to this headline">¶</a></h3>
<p>In Unicode, different sequences of characters could be defined as
equivalent depending on how they are encoded. See IETF RFC 3987,
section 5.3.2.2.</p>
</div>
<div class="section" id="ipv6-zone-ids-uri-definition-ipv6-zone-ids">
<h3>3.30 IPv6 Zone IDs [uri.definition.ipv6-zone-ids]<a class="headerlink" href="#ipv6-zone-ids-uri-definition-ipv6-zone-ids" title="Permalink to this headline">¶</a></h3>
<p>A zone index is used to identify to which scope a non-global address
belongs in an IPv6 address. It is specified in IETF RFC 6874.</p>
</div>
</div>
<span id="document-requirements"></span><div class="section" id="requirements-uri-requirements">
<span id="requirements"></span><h2>4 Requirements [uri.requirements]<a class="headerlink" href="#requirements-uri-requirements" title="Permalink to this headline">¶</a></h2>
<p>Throughout this Technical Specification, <tt class="docutils literal"><span class="pre">char</span></tt>, <tt class="docutils literal"><span class="pre">wchar_t</span></tt>,
<tt class="docutils literal"><span class="pre">char16_t</span></tt>, and <tt class="docutils literal"><span class="pre">char32_t</span></tt> are collectively called <em>encoded
character types</em>.</p>
<p>Template parameters named <tt class="docutils literal"><span class="pre">charT</span></tt> shall be one of the encoded
character types.</p>
<p>Template parameters named <tt class="docutils literal"><span class="pre">InputIterator</span></tt> shall meet the C++
Standard&#8217;s library input iterator requirements ([input.iterators]
C++11 section 24.2.3) and shall have a value type that is one of the
encoded character types.</p>
<blockquote>
<div>[<em>Note</em>: Use of an encoded character type implies an associated
encoding. Since <tt class="docutils literal"><span class="pre">signed</span> <span class="pre">char</span></tt> and <tt class="docutils literal"><span class="pre">unsigned</span> <span class="pre">char</span></tt> have no implied
encoding, they are not included as permitted types. <em>&#8211;end note</em>]</div></blockquote>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The above text uses similar wording to N3940 [<a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3940.html#fs.req">fs.req</a>]
section 5.</p>
</div>
<p>Function template parameters named <tt class="docutils literal"><span class="pre">Source</span></tt>, <tt class="docutils literal"><span class="pre">UserInfoSource</span></tt>,
<tt class="docutils literal"><span class="pre">HostSource</span></tt>, <tt class="docutils literal"><span class="pre">PortSource</span></tt>, <tt class="docutils literal"><span class="pre">KeySource</span></tt>, <tt class="docutils literal"><span class="pre">ParamSource</span></tt> shall
be one of:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">basic_string&lt;charT,</span> <span class="pre">traits,</span> <span class="pre">Allocator&gt;</span></tt>. The type charT shall
be an encoded character type.  A function argument <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Source&amp;</span>
<span class="pre">source</span></tt> shall have an effective range [<tt class="docutils literal"><span class="pre">cbegin(source)</span></tt>,
<tt class="docutils literal"><span class="pre">cend(source)</span></tt>).</li>
<li>A type meeting the input iterator requirements that iterates over a
NTCTS [defns.ntcts]. The value type shall be an encoded character
type. A function argument <tt class="docutils literal"><span class="pre">InputIterator</span> <span class="pre">begin</span></tt> shall have an
effective range [<tt class="docutils literal"><span class="pre">begin</span></tt>, <tt class="docutils literal"><span class="pre">end</span></tt>) where <tt class="docutils literal"><span class="pre">end</span></tt> is the first
iterator value with an element value equal to
<tt class="docutils literal"><span class="pre">iterator_traits&lt;InputIterator&gt;::value_type()</span></tt>.</li>
<li>A character array that after array-to-pointer decay results in a
pointer to a NTCTS. The value type shall be an encoded character
type. A function argument <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Source&amp;</span> <span class="pre">source</span></tt> shall have an
effective range [source, end) where end is the first iterator value
with an element value equal to
<tt class="docutils literal"><span class="pre">iterator_traits&lt;decay&lt;Source&gt;::type&gt;::value_type()</span></tt>.</li>
</ul>
<p>Arguments of type <tt class="docutils literal"><span class="pre">Source</span></tt>, <tt class="docutils literal"><span class="pre">UserInfoSource</span></tt>, <tt class="docutils literal"><span class="pre">HostSource</span></tt>,
<tt class="docutils literal"><span class="pre">PortSource</span></tt>, <tt class="docutils literal"><span class="pre">KeySource</span></tt>, <tt class="docutils literal"><span class="pre">ParamSource</span></tt> shall not be null
pointers.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This is similar wording to the filesystem path requirements in
N3940 (<a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3940.html#path-Requirements">[path.req]</a>).</p>
</div>
<p>The <tt class="docutils literal"><span class="pre">uri</span></tt> class shall parse according to the rules described in IETF
RFC 3986, Section 3.</p>
<p>The <tt class="docutils literal"><span class="pre">uri</span></tt> class shall correctly parse IPv6 addresses, described in
IETF RFC 3986.</p>
<p>The <tt class="docutils literal"><span class="pre">uri</span></tt> class shall parse internationalized URIs according to IETF
RFC 3987, section 2.</p>
<p>The <tt class="docutils literal"><span class="pre">uri</span></tt> class shall parse zone IDs in IPv6 addresses according to
IETF RFC 6874, section 2.</p>
<p>Template parameters named Allocator shall meet the C++ Standard&#8217;s
library Allocator requirements (C++11 17.6.3.5)</p>
</div>
<span id="document-header_synopsis"></span><div class="section" id="header-experimental-uri-synopsis-uri-header-synopsis">
<span id="header-synopsis"></span><h2>5 Header <tt class="docutils literal"><span class="pre">&lt;experimental/uri&gt;</span></tt> Synopsis [uri.header-synopsis]<a class="headerlink" href="#header-experimental-uri-synopsis-uri-header-synopsis" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre>#include &lt;string&gt;                     // std::basic_string
#include &lt;system_error&gt;               // std::error_code
#include &lt;iosfwd&gt;                     // std::basic_istream, std::basic_ostream
#include &lt;iterator&gt;                   // std::iterator_traits
#include &lt;memory&gt;                     // std::allocator
#include &lt;experimental/optional&gt;      // std::experimental::optional
#include &lt;experimental/string_view&gt;   // std::experimental::basic_string_view
#include &lt;experimental/filesystem&gt;    // std::experimental::filesystem::path

namespace std {
namespace experimental {
// class declarations
class uri;
class uri_builder;
class uri_error;

enum class uri_errc {
 // uri syntax errors
 invalid_syntax = 1,

 // uri reference and resolution errors
 base_uri_is_empty,
 base_uri_is_not_absolute,
 base_uri_is_opaque,
 base_uri_does_not_match,

 // builder errors
 invalid_uri,
 invalid_scheme,
 invalid_user_info,
 invalid_host,
 invalid_port,
 invalid_path,
 invalid_query,
 invalid_fragment,

 // decoding errors
 not_enough_input,
 non_hex_input,
 conversion_failed,
};

enum class uri_normalization_level {
 string_comparison,
 syntax_based,
};

// factory functions
template &lt;class Source&gt;
uri make_uri(const Source&amp; source, error_code&amp; ec);
template &lt;class InputIterator&gt;
uri make_uri(InputIterator first, InputIterator last, error_code&amp; ec);
template &lt;class Source, class Allocator&gt;
uri make_uri(const Source&amp; source, const Allocator&amp; a, error_code&amp; ec);
template &lt;class InputIterator, class Allocator&gt;
uri make_uri(InputIterator first, InputIterator last, const Allocator&amp; a, error_code&amp; ec);

// interoperability with filesystem::path
uri to_uri(const experimental::filesystem::path&amp; p);
template &lt;class Allocator&gt;
uri to_uri(const experimental::filesystem::path&amp; p, const Allocator&amp; a);
experimental::filesystem::path to_filesystem_path(const uri&amp; u);
experimental::filesystem::path to_filesystem_path(const uri&amp; u, error_code&amp; ec);

// equality and comparison operators
constexpr bool operator== (const uri&amp; lhs, const uri&amp; rhs) noexcept;
constexpr bool operator!= (const uri&amp; lhs, const uri&amp; rhs) noexcept;
constexpr bool operator&lt;  (const uri&amp; lhs, const uri&amp; rhs) noexcept;
constexpr bool operator&gt;  (const uri&amp; lhs, const uri&amp; rhs) noexcept;
constexpr bool operator&lt;= (const uri&amp; lhs, const uri&amp; rhs) noexcept;
constexpr bool operator&gt;= (const uri&amp; lhs, const uri&amp; rhs) noexcept;

// stream operators
template &lt;typename charT, class traits&gt;
basic_ostream&lt;charT, traits&gt;&amp;
operator&lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os, const uri&amp; u);
template &lt;typename charT, class traits&gt;
basic_istream&lt;charT, traits&gt;&amp;
operator&gt;&gt; (basic_istream&lt;charT, traits&gt;&amp; is, uri&amp; u);

// swap functions
void swap(uri&amp; lhs, uri&amp; rhs) noexcept;
} // namespace experimental

template &lt;class T&gt; struct hash;
template &lt;&gt; struct hash&lt;experimental::uri&gt;;

namespace experimental {
// error handling
error_code make_error_code(uri_errc e) noexcept;
error_condition make_error_condition(uri_errc e) noexcept;
const error_category&amp; uri_category() noexcept;
} // namespace experimental

template &lt;&gt;
struct is_error_code_enum&lt;experimental::uri_errc&gt; : public true_type { };
} // namespace std
</pre></div>
</div>
<div class="section" id="declarations-uri-header-synopsis-declarations">
<h3>5.1 Declarations [uri.header-synopsis.declarations]<a class="headerlink" href="#declarations-uri-header-synopsis-declarations" title="Permalink to this headline">¶</a></h3>
<p>The <tt class="docutils literal"><span class="pre">&lt;experimental/uri&gt;</span></tt> header contains a declaration for a <tt class="docutils literal"><span class="pre">uri</span></tt>
class, a <tt class="docutils literal"><span class="pre">uri_builder</span></tt> class and an exception class,
<tt class="docutils literal"><span class="pre">uri_error</span></tt> in the <tt class="docutils literal"><span class="pre">std::experimental</span></tt> namespace.</p>
</div>
<div class="section" id="factory-functions-uri-header-synopsis-factory-functions">
<h3>5.2 Factory functions [uri.header-synopsis.factory-functions]<a class="headerlink" href="#factory-functions-uri-header-synopsis-factory-functions" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>// factory functions
template &lt;class Source&gt;
uri make_uri(const Source&amp; source, error_code&amp; ec);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs an object of class <tt class="docutils literal"><span class="pre">uri</span></tt>. The source is
copied into the <tt class="docutils literal"><span class="pre">uri</span></tt> object and parsed. The encoding
is assumed to depend on the underlying character type and
implementation. On error, the <tt class="docutils literal"><span class="pre">error_code</span></tt> is set and
<tt class="docutils literal"><span class="pre">make_uri</span></tt> returns an empty <tt class="docutils literal"><span class="pre">uri</span></tt> object.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator&gt;
uri make_uri(InputIterator first, InputIterator last, error_code&amp; ec);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs an object of class <tt class="docutils literal"><span class="pre">uri</span></tt>. The source is
copied into the <tt class="docutils literal"><span class="pre">uri</span></tt> object and parsed. The encoding
is assumed to depend on the underlying character type and
implementation. On error, the <tt class="docutils literal"><span class="pre">error_code</span></tt> is set and
<tt class="docutils literal"><span class="pre">make_uri</span></tt> returns an empty <tt class="docutils literal"><span class="pre">uri</span></tt> object.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source, class Allocator&gt;
uri make_uri(const Source&amp; source, const Allocator&amp; a, error_code&amp; ec);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs an object of class <tt class="docutils literal"><span class="pre">uri</span></tt>. The source is
copied into the <tt class="docutils literal"><span class="pre">uri</span></tt> object and parsed. The encoding
is assumed to depend on the underlying character type and
implementation. On error, the <tt class="docutils literal"><span class="pre">error_code</span></tt> is set and
<tt class="docutils literal"><span class="pre">make_uri</span></tt> returns an empty <tt class="docutils literal"><span class="pre">uri</span></tt> object. All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class Allocator&gt;
uri make_uri(InputIterator first, InputIterator last, const Allocator&amp; a,
             error_code&amp; ec);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs an object of class <tt class="docutils literal"><span class="pre">uri</span></tt>. The source is
copied into the <tt class="docutils literal"><span class="pre">uri</span></tt> object and parsed. The encoding
is assumed to depend on the underlying character type and
implementation. On error, the <tt class="docutils literal"><span class="pre">error_code</span></tt> is set and
<tt class="docutils literal"><span class="pre">make_uri</span></tt> returns an empty <tt class="docutils literal"><span class="pre">uri</span></tt> object. All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
</div>
<div class="section" id="interoperability-with-std-experimental-filesystem-path-uri-header-synopsis-filesystem-interop">
<h3>5.3 Interoperability with <tt class="docutils literal"><span class="pre">std::experimental::filesystem::path</span></tt> [uri.header-synopsis.filesystem-interop]<a class="headerlink" href="#interoperability-with-std-experimental-filesystem-path-uri-header-synopsis-filesystem-interop" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>uri to_uri(const experimental::filesystem::path&amp; p);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Returns a <tt class="docutils literal"><span class="pre">uri</span></tt> object with the <tt class="docutils literal"><span class="pre">file</span></tt> scheme and the
absolute path to <tt class="docutils literal"><span class="pre">p</span></tt>. If <tt class="docutils literal"><span class="pre">p</span></tt> is absolute, the result
is an absolute URI with a scheme <tt class="docutils literal"><span class="pre">file</span></tt>. If <tt class="docutils literal"><span class="pre">p</span></tt> is
relative, the result is a URI relative reference.</div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>// On UNIX
std::experimental::filesystem::path p(&quot;/home/example/.bashrc&quot;);
std::experimental::uri u(std::experimental::to_uri(p));
assert(u.is_absolute());
assert(&quot;file:///home/example/.bashrc&quot; == u.string());
assert(&quot;/home/example/.bashrc&quot; == *u.path());
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::experimental::filesystem::path p(&quot;.bashrc&quot;);
std::experimental::uri u(std::experimental::to_uri(p));
assert(u.is_relative());
assert(&quot;.bashrc&quot; == u.string());
assert(&quot;.bashrc&quot; == *u.path());
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Allocator&gt;
uri to_uri(const experimental::filesystem::path&amp; p, const Allocator&amp; a);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Returns a <tt class="docutils literal"><span class="pre">uri</span></tt> object with the <tt class="docutils literal"><span class="pre">file</span></tt> scheme and the
absolute path to <tt class="docutils literal"><span class="pre">p</span></tt>. All memory allocation is
performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::experimental::filesystem::path p(&quot;/home/example/.bashrc&quot;);
my_ns::my_allocator a;
std::experimental::uri u(std::experimental::to_uri(p, a));
assert(&quot;file:///home/example/.bashrc&quot; == u.string());
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>experimental::filesystem::path to_filesystem_path(const uri&amp; u);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: If <tt class="docutils literal"><span class="pre">u</span></tt> is an absolute URI with the <tt class="docutils literal"><span class="pre">file</span></tt> scheme, the
result is a <tt class="docutils literal"><span class="pre">experimental::filesystem::path</span></tt> object
with an absolute path given a <tt class="docutils literal"><span class="pre">uri</span></tt>. If <tt class="docutils literal"><span class="pre">u</span></tt> is
relative, the result is a relative
<tt class="docutils literal"><span class="pre">experimental::filesystem::path</span></tt>. If the <tt class="docutils literal"><span class="pre">uri</span></tt> can
not be converted to an <tt class="docutils literal"><span class="pre">experimental::filesystem::path</span></tt>,
a <tt class="docutils literal"><span class="pre">uri_error</span></tt> is thrown.</div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>try {
  std::experimental::uri u(&quot;file:///home/example/.bashrc&quot;);
  std::experimental::filesystem::path p(std::experimental::to_filesystem_path(u));
  assert(p.is_absolute());
  assert(&quot;/home/example/.bashrc&quot; == p.string());
}
catch (const std::experimental::uri_error&amp; e) {
  // handle error
}
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>try {
  std::experimental::uri u(&quot;file:///home/example/&quot;);
  std::experimental::uri v(&quot;file:///home/example/.bashrc&quot;);
  std::experimental::uri w = u.make_relative(v);
  std::experimental::filesystem::path p(std::experimental::to_filesystem_path(w));
  assert(p.is_relative());
  assert(&quot;.bashrc&quot; == p.string());
}
catch (const std::experimental::uri_error&amp; e) {
  // handle error
}
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>experimental::filesystem::path to_filesystem_path(const uri&amp; u, error_code&amp; ec);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: If <tt class="docutils literal"><span class="pre">u</span></tt> is an absolute URI with the <tt class="docutils literal"><span class="pre">file</span></tt> scheme, the
result is a <tt class="docutils literal"><span class="pre">experimental::filesystem::path</span></tt> object
with an absolute path given a <tt class="docutils literal"><span class="pre">uri</span></tt>. If <tt class="docutils literal"><span class="pre">u</span></tt> is
relative, the result is a relative
<tt class="docutils literal"><span class="pre">experimental::filesystem::path</span></tt>. If the <tt class="docutils literal"><span class="pre">uri</span></tt> can
not be converted to a <tt class="docutils literal"><span class="pre">experimental::filesystem::path</span></tt>,
<tt class="docutils literal"><span class="pre">ec</span></tt> is set.</div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::experimental::uri u(&quot;file:///home/example/.bashrc&quot;);
std::error_code ec;
std::experimental::filesystem::path p(std::experimental::to_filesystem_path(u, ec));
if (!ec) {
  assert(p.is_absolute());
  assert(&quot;/home/example/.bashrc&quot; == p.string());
}
else {
  // handle error
}
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
</div>
<div class="section" id="equality-and-comparison-operators-uri-header-synopsis-equality-comparison">
<h3>5.4 Equality and Comparison Operators [uri.header-synopsis.equality-comparison]<a class="headerlink" href="#equality-and-comparison-operators-uri-header-synopsis-equality-comparison" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool operator== (const uri&amp; lhs, const uri&amp; rhs) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">lhs.compare(rhs,</span> <span class="pre">uri_normalization_level::string_comparison)</span> <span class="pre">==</span> <span class="pre">0</span></tt></div>
</div>
<blockquote>
<div>[<em>Note</em>: The equality operator uses a character-by-character
comparison of two <tt class="docutils literal"><span class="pre">uri</span></tt> objects. <em>&#8211;end note</em>]</div></blockquote>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool operator!= (const uri&amp; lhs, const uri&amp; rhs) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">!(lhs</span> <span class="pre">==</span> <span class="pre">rhs)</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool operator&lt;  (const uri&amp; lhs, const uri&amp; rhs) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">lhs.compare(rhs,</span> <span class="pre">uri_normalization_level::string_comparison)</span> <span class="pre">&lt;</span> <span class="pre">0</span></tt></div>
</div>
<blockquote>
<div>[<em>Note</em>: The less-than operator uses a character-by-character
comparison of two <tt class="docutils literal"><span class="pre">uri</span></tt> objects. <em>&#8211;end note</em>]</div></blockquote>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool operator&gt;  (const uri&amp; lhs, const uri&amp; rhs) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">(rhs</span> <span class="pre">&lt;</span> <span class="pre">lhs)</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool operator&lt;= (const uri&amp; lhs, const uri&amp; rhs) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">!(lhs</span> <span class="pre">&gt;</span> <span class="pre">rhs)</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool operator&gt;= (const uri&amp; lhs, const uri&amp; rhs) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">!(lhs</span> <span class="pre">&lt;</span> <span class="pre">rhs)</span></tt></div>
</div>
</div>
<div class="section" id="stream-operators-uri-header-synopsis-stream-operators">
<h3>5.5 Stream Operators [uri.header-synopsis.stream-operators]<a class="headerlink" href="#stream-operators-uri-header-synopsis-stream-operators" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>template &lt;typename charT, class traits&gt;
basic_ostream&lt;charT, traits&gt;&amp;
operator&lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os, const uri&amp; u);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: <tt class="docutils literal"><span class="pre">os</span> <span class="pre">&lt;&lt;</span> <span class="pre">u.to_string&lt;charT,</span> <span class="pre">traits&gt;();</span></tt>.</div>
</div>
<blockquote>
<div>[<em>Note</em>: <tt class="docutils literal"><span class="pre">u</span></tt> is percent encoded according to
[<a class="reference external" href="#percent-encoding-uri-definition-percent-encoding">uri.definition.percent-encoding</a>]]</div></blockquote>
<div class="highlight-python"><div class="highlight"><pre>template &lt;typename charT, class traits&gt;
basic_istream&lt;charT, traits&gt;&amp;
operator&gt;&gt; (basic_istream&lt;charT, traits&gt;&amp; is, uri&amp; u);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: <tt class="docutils literal"><span class="pre">string&lt;charT,</span> <span class="pre">traits&gt;</span> <span class="pre">tmp;</span> <span class="pre">is</span> <span class="pre">&gt;&gt;</span> <span class="pre">tmp;</span> <span class="pre">std::error_code</span> <span class="pre">ec;</span> <span class="pre">u</span> <span class="pre">=</span> <span class="pre">make_uri(tmp,</span> <span class="pre">ec);</span> <span class="pre">if</span> <span class="pre">(ec)</span> <span class="pre">is.setstate(ios_base::fail);</span></tt></div>
</div>
</div>
<div class="section" id="swap-uri-header-synopsis-swap">
<h3>5.6 Swap [uri.header-synopsis.swap]<a class="headerlink" href="#swap-uri-header-synopsis-swap" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>void swap(uri&amp; lhs, uri&amp; rhs) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: <tt class="docutils literal"><span class="pre">lhs.swap(rhs);</span></tt></div>
</div>
</div>
<div class="section" id="uri-hash-uri-header-synopsis-hash">
<h3>5.7 URI Hash [uri.header-synopsis.hash]<a class="headerlink" href="#uri-hash-uri-header-synopsis-hash" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>template &lt;&gt; struct hash&lt;experimental::uri&gt;;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: The template specialization shall meet the requirements
of class template hash (20.8.12).</div>
</div>
</div>
</div>
<span id="document-error_reporting"></span><div class="section" id="error-reporting-uri-error-reporting">
<span id="error-reporting"></span><h2>6 Error Reporting [uri.error-reporting]<a class="headerlink" href="#error-reporting-uri-error-reporting" title="Permalink to this headline">¶</a></h2>
<p>Some URI functions provide two overloads, one that throws an exception
to report errors, and a second that sets an <tt class="docutils literal"><span class="pre">std::error_code</span></tt>.</p>
<p>Member functions of <tt class="docutils literal"><span class="pre">uri</span></tt> not having an error of type
<tt class="docutils literal"><span class="pre">std::error_code&amp;</span></tt> report errors as follow, unless otherwise
specified:</p>
<ul class="simple">
<li>A <tt class="docutils literal"><span class="pre">uri_error</span></tt> is thrown.</li>
<li>Failure to allocate storage is reported by throwing an exception as
describe in the C++ standard, 17.6.4.10 [res.on.exception.handling].</li>
</ul>
<p>Functions that have an error of type <tt class="docutils literal"><span class="pre">std::error_code&amp;</span></tt> report
errors as follows:</p>
<ul class="simple">
<li>If a parsing error indicates an invalid URI, or a URI relative
reference is passed as a base URI, the <tt class="docutils literal"><span class="pre">std::error_code&amp;</span></tt> argument
is set as appropriate for the specific error. Otherwise, <tt class="docutils literal"><span class="pre">clear</span></tt>
is called on the <tt class="docutils literal"><span class="pre">error_code&amp;</span></tt> argument.</li>
</ul>
<div class="section" id="error-handling-uri-error-reporting-error-handling">
<h3>6.1 Error Handling [uri.error-reporting.error-handling]<a class="headerlink" href="#error-handling-uri-error-reporting-error-handling" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>error_code make_error_code(uri_errc e) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">error_code(static_cast&lt;int&gt;(e),</span> <span class="pre">uri_category())</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>error_condition make_error_condition(uri_errc e) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">error_condition(static_cast&lt;int&gt;(e),</span> <span class="pre">uri_category())</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>const error_category&amp; uri_category() noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A reference to an object of a type derived from class
error_category.</div>
</div>
<div class="line-block">
<div class="line"><cite>Remarks</cite>: The object&#8217;s <tt class="docutils literal"><span class="pre">default_error_condition</span></tt> and equivalent
virtual functions shall behave as specified for the class
<tt class="docutils literal"><span class="pre">error_category</span></tt>. The object&#8217;s <tt class="docutils literal"><span class="pre">name</span></tt> virtual
function shall return a pointer to the string <tt class="docutils literal"><span class="pre">&quot;uri&quot;</span></tt>.</div>
</div>
</div>
</div>
<span id="document-class_uri"></span><div class="section" id="class-uri-class-uri">
<span id="class-uri"></span><h2>7 Class <tt class="docutils literal"><span class="pre">uri</span></tt> [class.uri]<a class="headerlink" href="#class-uri-class-uri" title="Permalink to this headline">¶</a></h2>
<pre class="literal-block">
namespace std {
namespace experimental {
class uri {

public:

    // typedefs
    typedef <em>unspecified</em> value_type;
    typedef <em>implementation-defined</em> iterator;
    typedef <em>implementation-defined</em> const_iterator;
    typedef experimental::basic_string_view&lt;value_type&gt; string_view;

    // constructors and destructor
    uri();
    template &lt;class Source, class Allocator = allocator&lt;value_type&gt;&gt;
    explicit uri(const Source&amp; source, const Allocator&amp; a = Allocator());
    template &lt;class InputIterator, class Allocator = allocator&lt;value_type&gt;&gt;
    uri(InputIterator begin, InputIterator end, const Allocator&amp; a = Allocator());
    uri(const uri&amp; other);
    uri(uri&amp;&amp; other) noexcept;
    ~uri();

    // assignment
    uri&amp; operator= (const uri&amp; other);
    uri&amp; operator= (uri&amp;&amp; other) noexcept;

    // modifiers
    void swap(uri&amp; other) noexcept;

    // iterators
    constexpr const_iterator begin() const noexcept;
    constexpr const_iterator end() const noexcept;
    constexpr const_iterator cbegin() const noexcept;
    constexpr const_iterator cend() const noexcept;

    // accessors
    constexpr experimental::optional&lt;string_view&gt; scheme() const;
    constexpr experimental::optional&lt;string_view&gt; user_info() const;
    constexpr experimental::optional&lt;string_view&gt; host() const;
    constexpr experimental::optional&lt;string_view&gt; port() const;
    template &lt;class intT&gt;
    constexpr experimental::optional&lt;intT&gt; port() const;
    constexpr experimental::optional&lt;string_view&gt; path() const;
    constexpr experimental::optional&lt;string_view&gt; authority() const;
    constexpr experimental::optional&lt;string_view&gt; query() const;
    constexpr experimental::optional&lt;string_view&gt; fragment() const;

    // string accessors
    template &lt;class charT,
              class traits = char_traits&lt;charT&gt;,
              class Allocator = allocator&lt;charT&gt;&gt;
    basic_string&lt;charT, traits, Allocator&gt;
    to_string(const Allocator&amp; a = Allocator()) const;
    string string() const;
    wstring wstring() const;
    string u8string() const;
    u16string u16string() const;
    u32string u32string() const;

    // query
    constexpr bool empty() const noexcept;
    constexpr bool is_absolute() const noexcept;
    constexpr bool is_relative() const noexcept;
    constexpr bool is_hierarchical() const noexcept;
    constexpr bool is_opaque() const noexcept;

    // transformers
    uri normalize(uri_normalization_level level) const;
    template &lt;class Allocator&gt;
    uri normalize(uri_normalization_level level, const Allocator&amp; alloc) const;
    uri normalize(uri_normalization_level level, error_code&amp; ec) const;
    template &lt;class Allocator&gt;
    uri normalize(uri_normalization_level level, const Allocator&amp; alloc,
                  error_code&amp; ec) const;

    uri make_relative(const uri&amp; u) const;
    template &lt;class Allocator&gt;
    uri make_relative(const uri&amp; u, const Allocator&amp; a) const;
    uri make_relative(const uri&amp; u, error_code&amp; ec) const;
    template &lt;class Allocator&gt;
    uri make_relative(const uri&amp; u, const Allocator&amp; a, error_code&amp; ec) const;

    uri resolve(const uri&amp; u) const;
    template &lt;class Allocator&gt;
    uri resolve(const uri&amp; u, const Allocator&amp; a) const;
    uri resolve(const uri&amp; u, error_code&amp; ec) const;
    template &lt;class Allocator&gt;
    uri resolve(const uri&amp; u, const Allocator&amp; a, error_code&amp; ec) const;

    // comparison
    constexpr int compare(const uri&amp; other, uri_normalization_level level) const noexcept;

    // percent encoding and decoding
    template &lt;class InputIterator, class OutputIterator&gt;
    static OutputIterator encode_user_info(InputIterator begin, InputIterator end,
                                           OutputIterator out);
    template &lt;class InputIterator, class OutputIterator&gt;
    static OutputIterator encode_host(InputIterator begin, InputIterator end,
                                      OutputIterator out);
    template &lt;class InputIterator, class OutputIterator&gt;
    static OutputIterator encode_port(InputIterator begin, InputIterator end,
                                      OutputIterator out);
    template &lt;class InputIterator, class OutputIterator&gt;
    static OutputIterator encode_path(InputIterator begin, InputIterator end,
                                      OutputIterator out);
    template &lt;class InputIterator, class OutputIterator&gt;
    static OutputIterator encode_query(InputIterator begin, InputIterator end,
                                       OutputIterator out);
    template &lt;class InputIterator, class OutputIterator&gt;
    static OutputIterator encode_fragment(InputIterator begin, InputIterator end,
                                          OutputIterator out);
    template &lt;class InputIterator, class OutputIterator&gt;
    static OutputIterator decode(InputIterator begin, InputIterator end,
                                 OutputIterator out);

};
} // namespace experimental
} // namespace std
</pre>
<div class="section" id="uri-conversions-class-uri-conversions">
<h3>7.1 <tt class="docutils literal"><span class="pre">uri</span></tt> Conversions [class.uri.conversions]<a class="headerlink" href="#uri-conversions-class-uri-conversions" title="Permalink to this headline">¶</a></h3>
<p>For member functions returning strings, value type and encoding
conversion is performed if the value type of the argument or return
differs from <tt class="docutils literal"><span class="pre">uri::value_type</span></tt>. Encoding and method of conversion
for the argument or return value to be converted to is determined by
its value type:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">char</span></tt>: Encoding is UTF-8. Conversion method is unspecified.</li>
<li><tt class="docutils literal"><span class="pre">wchar_t</span></tt>: Encoding is unspecified. Conversion method is
unspecified.</li>
<li><tt class="docutils literal"><span class="pre">char16_t</span></tt>: Encoding is UTF-16. Conversion method is unspecified.</li>
<li><tt class="docutils literal"><span class="pre">char32_t</span></tt>: Encoding is UTF-32. Conversion method is unspecified.</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This is based on wording in the filesystem path requirements in
N3940
(<a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3940.html#path.arg.convert">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3940.html#path.arg.convert</a>)</p>
</div>
</div>
<div class="section" id="uri-requirements-class-uri-reqs">
<h3>7.2 <tt class="docutils literal"><span class="pre">uri</span></tt> Requirements [class.uri.reqs]<a class="headerlink" href="#uri-requirements-class-uri-reqs" title="Permalink to this headline">¶</a></h3>
<p>Each URI part is required to be a contiguous memory block.</p>
<p>Case normalization shall be performed according to IETF RFC 3986,
section 6.2.2.1 and IETF RFC 3987, section 5.3.2.1.</p>
<p>Percent encoding normalization shall be performed according to IETF
RFC 3986, section 6.2.2.2 and IETF RFC 3987, section 5.3.2.3.</p>
<p>Removing dot segments (&#8221;.&#8221;, &#8221;..&#8221;) from a path shall conform to IETF RFC
3986, section 5.2.4.</p>
<p>URI References returned by <tt class="docutils literal"><span class="pre">std::experimental::uri::make_relative</span></tt>
shall be transformed by using the algorithm in IETF RFC 3986, section
5.2.2.</p>
</div>
<div class="section" id="uri-members-class-uri-members">
<h3>7.3 <tt class="docutils literal"><span class="pre">uri</span></tt> members [class.uri.members]<a class="headerlink" href="#uri-members-class-uri-members" title="Permalink to this headline">¶</a></h3>
<div class="section" id="uri-constructors-class-uri-members-constructors">
<h4>7.3.1 <tt class="docutils literal"><span class="pre">uri</span></tt> constructors [class.uri.members.constructors]<a class="headerlink" href="#uri-constructors-class-uri-members-constructors" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre><span class="n">uri</span><span class="p">();</span>
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs an object of class <tt class="docutils literal"><span class="pre">uri</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">empty()</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri(const uri&amp; other);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs a <tt class="docutils literal"><span class="pre">uri</span></tt> object with the underlying data
having the original values of <tt class="docutils literal"><span class="pre">other</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri(uri&amp;&amp; other) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs a <tt class="docutils literal"><span class="pre">uri</span></tt> object with the underlying data
having the original values of <tt class="docutils literal"><span class="pre">other</span></tt>. <tt class="docutils literal"><span class="pre">other</span></tt> is
left in a valid, but unspecified state.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source, class Allocator = allocator&lt;value_type&gt;&gt;
uri(const Source&amp; source, const Allocator&amp; a = Allocator());
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: The source is copied into the <tt class="docutils literal"><span class="pre">uri</span></tt> object and
parsed. The encoding is assumed to depend on the
underlying character type and implementation. Conversion,
if any, is performed as specified by
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>]. All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">!empty()</span> <span class="pre">&amp;&amp;</span> <span class="pre">is_absolute()</span></tt></div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt> if <tt class="docutils literal"><span class="pre">source</span></tt> is not a valid URI string.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class Allocator = allocator&lt;value_type&gt;&gt;
uri(InputIterator begin, InputIterator end, const Allocator&amp; a = Allocator());
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: The source is copied into the <tt class="docutils literal"><span class="pre">uri</span></tt> object and
parsed. The encoding is assumed to depend on the
underlying character type and implementation. Conversion,
if any, is performed as specified by
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>]. All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">!empty()</span> <span class="pre">&amp;&amp;</span> <span class="pre">is_absolute()</span></tt></div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt> if the string in the range [<tt class="docutils literal"><span class="pre">begin</span></tt>,
<tt class="docutils literal"><span class="pre">end</span></tt>) is not a valid URI string.</div>
</div>
</div>
<div class="section" id="uri-assignment-class-uri-members-assignment">
<h4>7.3.2 <tt class="docutils literal"><span class="pre">uri</span></tt> assignment [class.uri.members.assignment]<a class="headerlink" href="#uri-assignment-class-uri-members-assignment" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>uri&amp; operator= (const uri&amp; other);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Modifies the underlying data to have the original values
of <tt class="docutils literal"><span class="pre">other</span></tt>. If <tt class="docutils literal"><span class="pre">this</span></tt> and <tt class="docutils literal"><span class="pre">other</span></tt> are the same
object, there is no effect.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri&amp; operator= (uri&amp;&amp; other) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Modifies the underlying data to have the original values
of <tt class="docutils literal"><span class="pre">other</span></tt>. <tt class="docutils literal"><span class="pre">other</span></tt> is left in a valid, but
unspecified state. If <tt class="docutils literal"><span class="pre">this</span></tt> and <tt class="docutils literal"><span class="pre">other</span></tt> are the same
object, there is no effect.</div>
</div>
</div>
<div class="section" id="uri-modifiers-class-uri-members-modifiers">
<h4>7.3.3. <tt class="docutils literal"><span class="pre">uri</span></tt> modifiers [class.uri.members.modifiers]<a class="headerlink" href="#uri-modifiers-class-uri-members-modifiers" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>void swap(uri&amp; other) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Swaps the contents of <tt class="docutils literal"><span class="pre">this</span></tt> object with the other.</div>
</div>
</div>
<div class="section" id="uri-iterators-class-uri-members-iterators">
<h4>7.3.4 <tt class="docutils literal"><span class="pre">uri</span></tt> iterators [class.uri.members.iterators]<a class="headerlink" href="#uri-iterators-class-uri-members-iterators" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>constexpr const_iterator begin() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A <tt class="docutils literal"><span class="pre">const_iterator</span></tt> to the first element in the
underlying string container.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr const_iterator end() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A <tt class="docutils literal"><span class="pre">const_iterator</span></tt> to the end of the underlying string
container.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr const_iterator cbegin() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A <tt class="docutils literal"><span class="pre">const_iterator</span></tt> to the first element in the
underlying string container.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr const_iterator cend() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A <tt class="docutils literal"><span class="pre">const_iterator</span></tt> to the end of the underlying string
container.</div>
</div>
</div>
<div class="section" id="uri-accessors-class-uri-members-accessors">
<h4>7.3.5 <tt class="docutils literal"><span class="pre">uri</span></tt> accessors [class.uri.members.accessors]<a class="headerlink" href="#uri-accessors-class-uri-members-accessors" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; scheme() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the scheme in the underlying URI. If
the scheme is not specified, it returns <tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; user_info() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the user info in the underlying
URI. If the user info is not specified, it returns
<tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; host() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the host in the underlying URI. If the
host is not specified, it returns <tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; port() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the port in the underlying URI. If the
port is not specified, it returns <tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class intT&gt;
constexpr experimental::optional&lt;intT&gt; port() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;intT&gt;</span></tt> with the port value,
if it is present. If the port is not specified, it
returns <tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Remarks</cite>: This function shall not participate in overload
resolution unless <tt class="docutils literal"><span class="pre">is_integral&lt;intT&gt;::value</span></tt> is true.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; path() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the path in the underlying URI. If the
path is not specified, it returns <tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; authority() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the authority in the underlying
URI. If the authority is not specified, it returns
<tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; query() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the query in the underlying URI. If
the query is not specified, it returns <tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr experimental::optional&lt;string_view&gt; fragment() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An <tt class="docutils literal"><span class="pre">experimental::optional&lt;string_view&gt;</span></tt> object which
spans the range of the fragment in the underlying URI. If
the fragment is not specified, it returns <tt class="docutils literal"><span class="pre">nullopt</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class charT,
          class traits = char_traits&lt;charT&gt;,
          class Allocator = allocator&lt;charT&gt;&gt;
basic_string&lt;charT, traits, Allocator&gt;
to_string(const Allocator&amp; a = Allocator()) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A string object containing a copy of the underlying URI
string. All memory allocation is performed by
<tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The name <tt class="docutils literal"><span class="pre">to_string</span></tt> has been chosen to be consistent with the
<tt class="docutils literal"><span class="pre">to_string</span></tt> member function in <tt class="docutils literal"><span class="pre">std::bitset</span></tt> [20.5.2.34]. This,
however, is inconsistent with the name (<tt class="docutils literal"><span class="pre">string</span></tt>) in the path
class in the filesystem working draft N3940 [path.native.obs]. The
same applies to all the string accessors.</p>
</div>
<div class="highlight-python"><div class="highlight"><pre>string string() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A string object containing a copy of the underlying URI
string.</div>
</div>
<div class="line-block">
<div class="line"><cite>Remarks</cite>: Conversion, if any, is performed as specified by
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>].</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>wstring wstring() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A wstring object containing a copy of the underlying URI
string.</div>
</div>
<div class="line-block">
<div class="line"><cite>Remarks</cite>: Conversion, if any, is performed as specified by
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>].</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>string u8string() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A UTF-8 encoded string object containing a copy of the
underlying URI string.</div>
</div>
<div class="line-block">
<div class="line"><cite>Remarks</cite>: Conversion, if any, is performed as specified by
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>].</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>u16string u16string() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A u16string object containing a copy of the underlying
URI string.</div>
</div>
<div class="line-block">
<div class="line"><cite>Remarks</cite>: Conversion, if any, is performed as specified by
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>].</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>u32string u32string() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A u32string object containing a copy of the underlying
URI string.</div>
</div>
<div class="line-block">
<div class="line"><cite>Remarks</cite>: Conversion, if any, is performed as specified by
[<a class="reference external" href="#uri-conversions-class-uri-conversions">class.uri.conversions</a>].</div>
</div>
</div>
<div class="section" id="uri-query-class-uri-members-query">
<h4>7.3.6 <tt class="docutils literal"><span class="pre">uri</span></tt> query [class.uri.members.query]<a class="headerlink" href="#uri-query-class-uri-members-query" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool empty() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">true</span></tt> if the underlying string object is empty,
<tt class="docutils literal"><span class="pre">false</span></tt> otherwise.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool is_absolute() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">true</span></tt> if the URI is absolute. Equivalent to
<tt class="docutils literal"><span class="pre">!scheme().empty()</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool is_relative() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">true</span></tt> if the URI is a relative reference. Equivalent
to <tt class="docutils literal"><span class="pre">!is_absolute()</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool is_hierarchical() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">true</span></tt> if the URI is absolute and its scheme is
hierarchical (i.e. the scheme-specific part starts with
two consecutive forward slash characters (&#8220;//&#8221;)).</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>constexpr bool is_opaque() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: <tt class="docutils literal"><span class="pre">true</span></tt> if the URI is absolute and its scheme is not
hierarchical (i.e. the scheme-specific part does not
start with two consecutive forward slash characters
(&#8220;//&#8221;) and its authority is empty). Equivalent to
<tt class="docutils literal"><span class="pre">!is_hierarchical()</span></tt>.</div>
</div>
</div>
<div class="section" id="uri-transformers-class-uri-members-transformers">
<h4>7.3.7 <tt class="docutils literal"><span class="pre">uri</span></tt> transformers [class.uri.members.transformers]<a class="headerlink" href="#uri-transformers-class-uri-members-transformers" title="Permalink to this headline">¶</a></h4>
<p>This proposal specifies three transformer functions:,
<tt class="docutils literal"><span class="pre">normalize</span></tt>, <tt class="docutils literal"><span class="pre">make_relative</span></tt> and <tt class="docutils literal"><span class="pre">resolve</span></tt>.</p>
<div class="highlight-python"><div class="highlight"><pre>uri normalize(uri_normalization_level level) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: <tt class="docutils literal"><span class="pre">normalize</span></tt> returns a normalized <tt class="docutils literal"><span class="pre">uri</span></tt> object.</div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">u.normalize(level).compare(u,</span> <span class="pre">level)</span> <span class="pre">==</span> <span class="pre">0</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Allocator&gt;
uri normalize(uri_normalization_level level, const Allocator&amp; a) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: <tt class="docutils literal"><span class="pre">normalize</span></tt> returns a normalized <tt class="docutils literal"><span class="pre">uri</span></tt> object. All
memory allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">u.normalize(level).compare(u,</span> <span class="pre">level)</span> <span class="pre">==</span> <span class="pre">0</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri normalize(uri_normalization_level level, error_code&amp; ec) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: <tt class="docutils literal"><span class="pre">normalize</span></tt> returns a normalized <tt class="docutils literal"><span class="pre">uri</span></tt> object. <tt class="docutils literal"><span class="pre">ec</span></tt>
is set on error and <tt class="docutils literal"><span class="pre">normalize</span></tt> returns an empty
<tt class="docutils literal"><span class="pre">uri</span></tt> object.</div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">ec</span> <span class="pre">||</span> <span class="pre">u.normalize(level).compare(u,</span> <span class="pre">level)</span> <span class="pre">==</span> <span class="pre">0</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Allocator&gt;
uri normalize(uri_normalization_level level, const Allocator&amp; a,
              error_code&amp; ec) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: <tt class="docutils literal"><span class="pre">normalize</span></tt> returns a normalized <tt class="docutils literal"><span class="pre">uri</span></tt> object. All
memory allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>. <tt class="docutils literal"><span class="pre">ec</span></tt> is set on
error and <tt class="docutils literal"><span class="pre">normalize</span></tt> returns an empty <tt class="docutils literal"><span class="pre">uri</span></tt> object.</div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">ec</span> <span class="pre">||</span> <span class="pre">u.normalize(level).compare(u,</span> <span class="pre">level)</span> <span class="pre">==</span> <span class="pre">0</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri make_relative(const uri&amp; u) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Returns a relative URI reference of <tt class="docutils literal"><span class="pre">u</span></tt> against
<tt class="docutils literal"><span class="pre">*this</span></tt> as the base URI. If <tt class="docutils literal"><span class="pre">*this</span></tt> or <tt class="docutils literal"><span class="pre">u</span></tt> are
opaque, or if the scheme and authority are not identical,
or if the path of <tt class="docutils literal"><span class="pre">*this</span></tt> is not a prefix of the path
in <tt class="docutils literal"><span class="pre">u</span></tt>, or if <tt class="docutils literal"><span class="pre">*this</span></tt> is a relative reference, then a
<tt class="docutils literal"><span class="pre">uri_error</span></tt> is thrown. Making a relative URI reference
is the inverse of resolving a URI, such that for two
normalized <tt class="docutils literal"><span class="pre">uri</span></tt> objects, <tt class="docutils literal"><span class="pre">u</span></tt> and <tt class="docutils literal"><span class="pre">v</span></tt>,
<tt class="docutils literal"><span class="pre">u.make_relative(v).resolve(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt> and
<tt class="docutils literal"><span class="pre">u.resolve(v).make_relative(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A relative URI reference.</div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt></div>
</div>
<div class="line-block">
<div class="line"><cite>Example:</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>try {
  std::experimental::uri u(&quot;http://www.example.org/path/&quot;);
  std::experimental::uri v(&quot;http://www.example.org/path/to/file.html&quot;);
  std::experimental::uri w = u.make_relative(v);
  assert(w.string() == &quot;to/file.html&quot;);
}
catch (const std::experimental::uri_error&amp; e) {
  // handle error
}
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Allocator&gt;
uri make_relative(const uri&amp; u, const Allocator&amp; a) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Returns a relative URI reference of <tt class="docutils literal"><span class="pre">u</span></tt> against
<tt class="docutils literal"><span class="pre">*this</span></tt> as the base URI. If <tt class="docutils literal"><span class="pre">*this</span></tt> or <tt class="docutils literal"><span class="pre">u</span></tt> are
opaque, or if the scheme and authority are not identical,
or if the path of <tt class="docutils literal"><span class="pre">*this</span></tt> is not a prefix of the path
in <tt class="docutils literal"><span class="pre">u</span></tt>, or if <tt class="docutils literal"><span class="pre">*this</span></tt> is a relative reference, then a
<tt class="docutils literal"><span class="pre">uri_error</span></tt> is thrown. Making a relative URI reference
is the inverse of resolving a URI, such that for two
normalized <tt class="docutils literal"><span class="pre">uri</span></tt> objects, <tt class="docutils literal"><span class="pre">u</span></tt> and <tt class="docutils literal"><span class="pre">v</span></tt>,
<tt class="docutils literal"><span class="pre">u.make_relative(v).resolve(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt> and
<tt class="docutils literal"><span class="pre">u.resolve(v).make_relative(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt>. All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A relative URI reference.</div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt></div>
</div>
<div class="line-block">
<div class="line"><cite>Example:</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::allocator&lt;std::experimental::uri::value_type&gt; a;
try {
  std::experimental::uri u(&quot;http://www.example.org/path/&quot;, a);
  std::experimental::uri v(&quot;http://www.example.org/path/to/file.html&quot;, a);
  std::experimental::uri w = v.make_relative(u, a);
  assert(w.string() == &quot;to/file.html&quot;);
}
catch (const std::experimental::uri_error&amp; e) {
  // handle error
}
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri make_relative(const uri&amp; base, error_code&amp; ec) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Returns a relative URI reference of <tt class="docutils literal"><span class="pre">u</span></tt> against
<tt class="docutils literal"><span class="pre">*this</span></tt> as the base URI. If <tt class="docutils literal"><span class="pre">*this</span></tt> or <tt class="docutils literal"><span class="pre">u</span></tt> are
opaque, or if the scheme and authority are not identical,
or if the path of <tt class="docutils literal"><span class="pre">*this</span></tt> is not a prefix of the path
in <tt class="docutils literal"><span class="pre">u</span></tt>, or if <tt class="docutils literal"><span class="pre">*this</span></tt> is a relative reference, then
<tt class="docutils literal"><span class="pre">ec</span></tt> is set and <tt class="docutils literal"><span class="pre">make_relative</span></tt> returns an empty
<tt class="docutils literal"><span class="pre">uri</span></tt> object. Making a relative URI reference is the
inverse of resolving a URI, such that for two normalized
<tt class="docutils literal"><span class="pre">uri</span></tt> objects, <tt class="docutils literal"><span class="pre">u</span></tt> and <tt class="docutils literal"><span class="pre">v</span></tt>,
<tt class="docutils literal"><span class="pre">u.make_relative(v).resolve(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt> and
<tt class="docutils literal"><span class="pre">u.resolve(v).make_relative(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A relative URI reference.</div>
</div>
<div class="line-block">
<div class="line"><cite>Example:</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::experimental::uri u(&quot;http://www.example.org/path/&quot;);
std::experimental::uri v(&quot;http://www.example.org/path/to/file.html&quot;);
std::error_code ec;
std::experimental::uri w = v.make_relative(u, ec);
if (!ec) {
  assert(w.string() == &quot;to/file.html&quot;);
}
else {
  // handle error
}
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Allocator&gt;
uri make_relative(const uri&amp; base, const Allocator &amp;a,
                  error_code&amp; ec) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Returns a relative URI reference of <tt class="docutils literal"><span class="pre">u</span></tt> against
<tt class="docutils literal"><span class="pre">*this</span></tt> as the base URI. If <tt class="docutils literal"><span class="pre">*this</span></tt> or <tt class="docutils literal"><span class="pre">u</span></tt> are
opaque, or if the scheme and authority are not identical,
or if the path of <tt class="docutils literal"><span class="pre">*this</span></tt> is not a prefix of the path
in <tt class="docutils literal"><span class="pre">u</span></tt>, or if <tt class="docutils literal"><span class="pre">*this</span></tt> is a relative reference, then
<tt class="docutils literal"><span class="pre">ec</span></tt> is set and <tt class="docutils literal"><span class="pre">make_relative</span></tt> returns an empty
<tt class="docutils literal"><span class="pre">uri</span></tt> object. Making a relative URI reference is the
inverse of resolving a URI, such that for two normalized
<tt class="docutils literal"><span class="pre">uri</span></tt> objects, <tt class="docutils literal"><span class="pre">u</span></tt> and <tt class="docutils literal"><span class="pre">v</span></tt>,
<tt class="docutils literal"><span class="pre">u.make_relative(v).resolve(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt> and
<tt class="docutils literal"><span class="pre">u.resolve(v).make_relative(v)</span> <span class="pre">==</span> <span class="pre">u</span></tt>. All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A relative URI reference.</div>
</div>
<div class="line-block">
<div class="line"><cite>Example:</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::allocator&lt;std::experimental::uri::value_type&gt; a;
std::experimental::uri u(&quot;http://www.example.org/path/&quot;, a);
std::experimental::uri v(&quot;http://www.example.org/path/to/file.html&quot;, a);
std::error_code ec;
std::experimental::uri w = v.make_relative(u, a, ec);
if (!ec) {
  assert(w.string() == &quot;to/file.html&quot;);
}
else {
  // handle error ec
}
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri resolve(const uri&amp; u) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Resolves <tt class="docutils literal"><span class="pre">u</span></tt> against <tt class="docutils literal"><span class="pre">*this</span></tt> according to IETF RFC
3986, section 5.2.1, then transforms the reference
according to IETF 3986, section 5.2.2. The resolved
<tt class="docutils literal"><span class="pre">uri</span></tt> object is returned. A <tt class="docutils literal"><span class="pre">uri_error</span></tt> is thrown if
<tt class="docutils literal"><span class="pre">*this</span></tt> is invalid
(<a class="reference internal" href="index.html#uri-reference-and-resolution-errors"><em>10.2 URI Reference and Resolution Errors [class.uri_errc.rar]</em></a>).</div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Allocator&gt;
uri resolve(const uri&amp; u, const Allocator&amp; a) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Resolves <tt class="docutils literal"><span class="pre">u</span></tt> against <tt class="docutils literal"><span class="pre">*this</span></tt> according to IETF RFC
3986, section 5.2.1, then transforms the reference
according to IETF 3986, section 5.2.2. The resolved
<tt class="docutils literal"><span class="pre">uri</span></tt> object is returned. A <tt class="docutils literal"><span class="pre">uri_error</span></tt> is thrown if
<tt class="docutils literal"><span class="pre">*this</span></tt> is invalid
(<a class="reference internal" href="index.html#uri-reference-and-resolution-errors"><em>10.2 URI Reference and Resolution Errors [class.uri_errc.rar]</em></a>). All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri resolve(const uri&amp; u, error_code&amp; ec) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Resolves <tt class="docutils literal"><span class="pre">u</span></tt> against <tt class="docutils literal"><span class="pre">*this</span></tt> according to IETF RFC
3986, section 5.2.1, then transforms the reference
according to IETF 3986, section 5.2.2. The resolved
<tt class="docutils literal"><span class="pre">uri</span></tt> object is returned. <tt class="docutils literal"><span class="pre">ec</span></tt> is set on error and
<tt class="docutils literal"><span class="pre">resolve</span></tt> returns an empty <tt class="docutils literal"><span class="pre">uri</span></tt> object.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Allocator&gt;
uri resolve(const uri&amp; u, const Allocator&amp; a, error_code&amp; ec) const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Resolves <tt class="docutils literal"><span class="pre">u</span></tt> against <tt class="docutils literal"><span class="pre">*this</span></tt> according to IETF RFC
3986, section 5.2.1, then transforms the reference
according to IETF 3986, section 5.2.2. The resolved
<tt class="docutils literal"><span class="pre">uri</span></tt> object is returned. <tt class="docutils literal"><span class="pre">ec</span></tt> is set on error and
<tt class="docutils literal"><span class="pre">resolve</span></tt> returns an empty <tt class="docutils literal"><span class="pre">uri</span></tt> object. All memory
allocation is performed by <tt class="docutils literal"><span class="pre">a</span></tt>.</div>
</div>
</div>
<div class="section" id="uri-comparison-class-uri-members-comparison">
<h4>7.3.8 <tt class="docutils literal"><span class="pre">uri</span></tt> comparison [class.uri.members.comparison]<a class="headerlink" href="#uri-comparison-class-uri-members-comparison" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>constexpr int compare(const uri&amp; other, uri_normalization_level level) const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Equivalent to <tt class="docutils literal"><span class="pre">normalize(level)</span> <span class="pre">==</span> <span class="pre">other.normalize(level)</span></tt></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: -1 if the normalized value of this is lexicographically
less than the normalized value <tt class="docutils literal"><span class="pre">other</span></tt>, given the
comparison <tt class="docutils literal"><span class="pre">level</span></tt>; 0 if they are considered equal and
1 if this is greater.</div>
</div>
</div>
<div class="section" id="uri-percent-encoding-class-uri-members-percent">
<h4>7.3.9 <tt class="docutils literal"><span class="pre">uri</span></tt> percent encoding [class.uri.members.percent]<a class="headerlink" href="#uri-percent-encoding-class-uri-members-percent" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class OutputIterator&gt;
static OutputIterator encode_user_info(InputIterator begin, InputIterator end,
                                       OutputIterator out);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Encodes special characters for the user_info part (IETF
RFC 3986, section 2.1).</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An iterator to the last element of a <tt class="docutils literal"><span class="pre">user_info</span></tt> string
that has been encoded.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class OutputIterator&gt;
static OutputIterator encode_host(InputIterator begin, InputIterator end,
                                  OutputIterator out);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Encodes special characters for the host part (IETF RFC
3986, section 2.1).</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An iterator to the last element of a <tt class="docutils literal"><span class="pre">host</span></tt> string that
has been encoded.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class OutputIterator&gt;
static OutputIterator encode_port(InputIterator begin, InputIterator end,
                                  OutputIterator out);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Encodes special characters for the port part (IETF RFC 3986,
section 2.1).</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An iterator to the last element of a <tt class="docutils literal"><span class="pre">port</span></tt> string that
has been encoded.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class OutputIterator&gt;
static OutputIterator encode_path(InputIterator begin, InputIterator end,
                                  OutputIterator out);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Encodes special characters for the path part (IETF RFC 3986,
section 2.1).</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An iterator to the last element of a <tt class="docutils literal"><span class="pre">path</span></tt> string that
has been encoded.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class OutputIterator&gt;
static OutputIterator encode_query(InputIterator begin, InputIterator end,
                                   OutputIterator out);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Encodes special characters for the query part (IETF RFC 3986,
section 2.1).</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An iterator to the last element of a <tt class="docutils literal"><span class="pre">query</span></tt> string that
has been encoded.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class OutputIterator&gt;
static OutputIterator encode_fragment(InputIterator begin, InputIterator end,
                                      OutputIterator out);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Encodes special characters for the fragment part (IETF RFC 3986,
section 2.1).</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An iterator to the last element of a <tt class="docutils literal"><span class="pre">fragment</span></tt> string that
has been encoded.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class InputIterator, class OutputIterator&gt;
static OutputIterator decode(InputIterator begin, InputIterator end,
                             OutputIterator out);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Decodes special characters in the source string and
returns the unencoded string (IETF RFC 3986, section 2.1)</div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: An iterator to the last element of a <tt class="docutils literal"><span class="pre">uri</span></tt> string that
has been decoded.</div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt> when the input is exhausted, the input is
not a hexadecimal character or when the decoding
conversion fails.</div>
</div>
</div>
</div>
</div>
<span id="document-class_uri_builder"></span><div class="section" id="class-uri-builder-class-uri-builder">
<span id="class-uri-builder"></span><h2>8 Class <tt class="docutils literal"><span class="pre">uri_builder</span></tt> [class.uri_builder]<a class="headerlink" href="#class-uri-builder-class-uri-builder" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre>namespace std {
namespace experimental {
class uri_builder {

public:

    // constructors and destructor
    uri_builder();
    explicit uri_builder(const uri&amp; base_uri);
    template &lt;class Source&gt;
    explicit uri_builder(const Source&amp; base_uri);
    template &lt;class InputIterator&gt;
    uri_builder(InputIterator begin, InputIterator end);
    uri_builder(const uri_builder&amp; other);
    uri_builder(uri_builder&amp;&amp; other) noexcept;
    ~uri_builder();

    // assignment
    uri_builder&amp; operator= uri_builder(const uri_builder&amp;);
    uri_builder&amp; operator= uri_builder(uri_builder&amp;&amp;) noexcept;

    // modifiers
    void swap(uri_builder&amp; other) noexcept;

    // setters
    template &lt;class Source&gt;
    uri_builder&amp; scheme(const Source&amp; scheme);
    template &lt;class InputIterator&gt;
    uri_builder&amp; scheme(InputIterator begin, InputIterator end);
    template &lt;class Source&gt;
    uri_builder&amp; user_info(const Source&amp; user_info);
    template &lt;class InputIterator&gt;
    uri_builder&amp; user_info(InputIterator begin, InputIterator end);
    template &lt;class Source&gt;
    uri_builder&amp; host(const Source&amp; host);
    template &lt;class InputIterator&gt;
    uri_builder&amp; host(InputIterator begin, InputIterator end);
    template &lt;class Source&gt;
    uri_builder&amp; port(const Source&amp; port);
    template &lt;class InputIterator&gt;
    uri_builder&amp; port(InputIterator begin, InputIterator end);
    template &lt;class Source&gt;
    uri_builder&amp; authority(const Source&amp; authority);
    template &lt;class InputIterator&gt;
    uri_builder&amp; authority(InputIterator begin, InputIterator end);
    template &lt;class UserInfoSource, class HostSource, PortSource&gt;
    uri_builder&amp; authority(const UserInfoSource&amp; user_info,
                           const HostSource&amp; host, const PortSource&amp; port);
    template &lt;class Source&gt;
    uri_builder&amp; path(const Source&amp; path);
    template &lt;class InputIterator&gt;
    uri_builder&amp; path(InputIterator begin, InputIterator end);
    template &lt;class Source&gt;
    uri_builder&amp; append_path(const Source&amp; path);
    template &lt;class InputIterator&gt;
    uri_builder&amp; append_path(InputIterator begin, InputIterator end);
    template &lt;class Source&gt;
    uri_builder&amp; query(const Source&amp; query);
    template &lt;class InputIterator&gt;
    uri_builder&amp; query(InputIterator begin, InputIterator end);
    template &lt;class KeySource, class ParamSource&gt;
    uri_builder&amp; append_query(const KeySource&amp; key, const ParamSource&amp; param);
    template &lt;class Source&gt;
    uri_builder&amp; fragment(const Source&amp; fragment);
    template &lt;class InputIterator&gt;
    uri_builder&amp; fragment(InputIterator begin, InputIterator end);

    // builder
    uri uri() const;

};
} // namespace experimental
} // namespace std
</pre></div>
</div>
<div class="section" id="uri-builder-requirements-class-uri-builder-requirements">
<h3>8.1 <tt class="docutils literal"><span class="pre">uri_builder</span></tt> requirements [class.uri_builder.requirements]<a class="headerlink" href="#uri-builder-requirements-class-uri-builder-requirements" title="Permalink to this headline">¶</a></h3>
<p>The URI shall be built according to component recomposition rules in
IETF RFC 3986, section 5.3.</p>
</div>
<div class="section" id="uri-builder-constructors-class-uri-builder-constructors">
<h3>8.2 <tt class="docutils literal"><span class="pre">uri_builder</span></tt> constructors [class.uri_builder.constructors]<a class="headerlink" href="#uri-builder-constructors-class-uri-builder-constructors" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="n">uri_builder</span><span class="p">();</span>
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: An immediate call to <tt class="docutils literal"><span class="pre">uri()</span></tt> will result in an empty
object.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri_builder(const uri&amp; base_uri);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs a <tt class="docutils literal"><span class="pre">uri_builder</span></tt> object from a base URI
[<a class="reference external" href="#base-uri-uri-definition-base-uri">uri.definition.base-uri</a>].</div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::experimental::uri base_uri(&quot;http://www.example.com&quot;);
std::experimental::uri_builder builder(uri);
builder.path(&quot;path&quot;);
assert(builder.uri() == &quot;http://www.example.com/path&quot;);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder(const Source&amp; base_uri);
template &lt;class InputIterator&gt;
uri_builder(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs a <tt class="docutils literal"><span class="pre">uri_builder</span></tt> object from a base URI
[<a class="reference external" href="#base-uri-uri-definition-base-uri">uri.definition.base-uri</a>].</div>
</div>
<div class="line-block">
<div class="line"><cite>Example</cite>:</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>std::experimental::uri_builder builder(&quot;http://www.example.com&quot;);
builder.path(&quot;path&quot;);
assert(builder.uri() == &quot;http://www.example.com/path&quot;);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>End example</cite></div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt> if <tt class="docutils literal"><span class="pre">base_uri</span></tt> is not a valid URI.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri_builder(const uri_builder&amp; other);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs a <tt class="docutils literal"><span class="pre">uri</span></tt> object with the underlying data
having the original values of <tt class="docutils literal"><span class="pre">other</span></tt>.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri_builder(uri_builder&amp;&amp; other) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Constructs a <tt class="docutils literal"><span class="pre">uri</span></tt> object with the underlying data
having the original values of <tt class="docutils literal"><span class="pre">other</span></tt>. <tt class="docutils literal"><span class="pre">other</span></tt> is
left in a valid, but unspecified state.</div>
</div>
</div>
<div class="section" id="uri-builder-assignment-class-uri-builder-members-assignment">
<h3>8.3 <tt class="docutils literal"><span class="pre">uri_builder</span></tt> assignment [class. uri_builder.members.assignment]<a class="headerlink" href="#uri-builder-assignment-class-uri-builder-members-assignment" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>uri_builder&amp; operator= (const uri_builder&amp; other);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Modifies the underlying data to have the original values
of <tt class="docutils literal"><span class="pre">other</span></tt>. If <tt class="docutils literal"><span class="pre">this</span></tt> and <tt class="docutils literal"><span class="pre">other</span></tt> are the same object,
there is no effect.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri_builder&amp; operator= (uri_builder&amp;&amp; other) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Modifies the underlying data to have the original values
of <tt class="docutils literal"><span class="pre">other</span></tt>. <tt class="docutils literal"><span class="pre">other</span></tt> is left in a valid, but
unspecified state. If <tt class="docutils literal"><span class="pre">this</span></tt> and <tt class="docutils literal"><span class="pre">other</span></tt> are the same
object, there is no effect.</div>
</div>
</div>
<div class="section" id="uri-builder-members-class-uri-builder-members">
<h3>8.4 <tt class="docutils literal"><span class="pre">uri_builder</span></tt> members [class.uri_builder.members]<a class="headerlink" href="#uri-builder-members-class-uri-builder-members" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>void swap(uri_builder&amp; other) noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Swaps the contents of <tt class="docutils literal"><span class="pre">this</span></tt> object with the other.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; scheme(const Source&amp; scheme);
template &lt;class InputIterator&gt;
uri_builder&amp; scheme(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI scheme.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; user_info(const Source&amp; user_info);
template &lt;class InputIterator&gt;
uri_builder&amp; user_info(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI user_info.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; host(const Source&amp; host);
template &lt;class InputIterator&gt;
uri_builder&amp; host(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI host.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; port(const Source&amp; port);
template &lt;class InputIterator&gt;
uri_builder&amp; port(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI port.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; authority(const Source&amp; authority);
template &lt;class InputIterator&gt;
uri_builder&amp; authority(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI authority.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class UserInfoSource, class HostSource, class PortSource&gt;
uri_builder&amp; authority(const UserInfoSource&amp; user_info,
                       const HostSource&amp; host, const PortSource&amp; port);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI user info, host and port.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; path(const Source&amp; path);
template &lt;class InputIterator&gt;
uri_builder&amp; path(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI path.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; append_path(const Source&amp; path);
template &lt;class InputIterator&gt;
uri_builder&amp; append_path(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Appends an element to the <tt class="docutils literal"><span class="pre">uri</span></tt> object&#8217;s path.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; query(const Source&amp; query);
template &lt;class InputIterator&gt;
uri_builder&amp; query(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI query.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class KeySource, class ParamSource&gt;
uri_builder&amp; append_query(const KeySource&amp; key, const ParamSource&amp; param);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Appends a key-value pair to the <tt class="docutils literal"><span class="pre">uri</span></tt> object&#8217;s query.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>template &lt;class Source&gt;
uri_builder&amp; fragment(const Source&amp; fragment);
template &lt;class InputIterator&gt;
uri_builder&amp; fragment(InputIterator begin, InputIterator end);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Sets the URI fragment.</div>
</div>
<div class="highlight-python"><div class="highlight"><pre>uri uri() const;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Effects</cite>: Builds a URI object from the provided parts. A URI built
using this method should be normalized according to
syntax-based normalization. This includes case
normalization, percent-encoding normalization, character
normalization and path segment normalization.</div>
</div>
<div class="line-block">
<div class="line"><cite>Throws</cite>: <tt class="docutils literal"><span class="pre">uri_error</span></tt> if any of the parts are invalid and a valid
uri cannot be formed.</div>
</div>
</div>
</div>
<span id="document-class_uri_error"></span><div class="section" id="class-uri-error-class-uri-error">
<span id="uri-error"></span><h2>9 Class <tt class="docutils literal"><span class="pre">uri_error</span></tt> [class.uri_error]<a class="headerlink" href="#class-uri-error-class-uri-error" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre>namespace std {
namespace experimental {
class uri_error : public system_error {
public:
    uri_error(const string&amp; what_arg, error_code ec);
    virtual ~uri_error();
    virtual const char *what() const noexcept;
};
} // namespace experimental
} // namespace std
</pre></div>
</div>
<div class="section" id="uri-error-members-class-uri-error-members">
<h3>9.1 <tt class="docutils literal"><span class="pre">uri_error</span></tt> members [class.uri_error.members]<a class="headerlink" href="#uri-error-members-class-uri-error-members" title="Permalink to this headline">¶</a></h3>
<div class="section" id="uri-error-constructors-class-uri-error-constructors">
<h4>9.1.1 <tt class="docutils literal"><span class="pre">uri_error</span></tt> constructors [class.uri_error.constructors]<a class="headerlink" href="#uri-error-constructors-class-uri-error-constructors" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>uri_error(const string&amp; what_arg, error_code ec);
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Postconditions</cite>: <tt class="docutils literal"><span class="pre">what()</span> <span class="pre">==</span> <span class="pre">what_arg.c_str()</span> <span class="pre">&amp;&amp;</span> <span class="pre">code()</span> <span class="pre">==</span> <span class="pre">ec</span></tt></div>
</div>
</div>
<div class="section" id="uri-error-accessors-class-uri-error-accessors">
<h4>9.1.2 <tt class="docutils literal"><span class="pre">uri_error</span></tt> accessors [class.uri_error.accessors]<a class="headerlink" href="#uri-error-accessors-class-uri-error-accessors" title="Permalink to this headline">¶</a></h4>
<div class="highlight-python"><div class="highlight"><pre>const char *what() const noexcept;
</pre></div>
</div>
<div class="line-block">
<div class="line"><cite>Returns</cite>: A string containing the message in the string passed as
<tt class="docutils literal"><span class="pre">what_arg</span></tt> to the class constructor.</div>
</div>
</div>
</div>
</div>
<span id="document-class_uri_errc"></span><div class="section" id="enum-class-uri-errc-class-uri-errc">
<span id="uri-errc"></span><h2>10 Enum class <tt class="docutils literal"><span class="pre">uri_errc</span></tt> [class.uri_errc]<a class="headerlink" href="#enum-class-uri-errc-class-uri-errc" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre>enum class uri_errc {
 // uri syntax errors
 invalid_syntax = 1,

 // uri relative reference and resolution errors
 base_uri_is_empty,
 base_uri_is_not_absolute,
 base_uri_is_opaque,
 base_uri_does_not_match,

 // builder errors
 invalid_uri,
 invalid_scheme,
 invalid_user_info,
 invalid_host,
 invalid_port,
 invalid_path,
 invalid_query,
 invalid_fragment,

 // decoding errors
 not_enough_input,
 non_hex_input,
 conversion_failed,
};
</pre></div>
</div>
<div class="section" id="uri-syntax-errors-class-uri-errc-uri-syntax">
<h3>10.1 URI Syntax Errors [class.uri_errc.uri_syntax]<a class="headerlink" href="#uri-syntax-errors-class-uri-errc-uri-syntax" title="Permalink to this headline">¶</a></h3>
<div class="section" id="invalid-syntax-class-uri-errc-uri-syntax-invalid-syntax">
<h4>10.1.1 <tt class="docutils literal"><span class="pre">invalid_syntax</span></tt> [class.uri_errc.uri_syntax.invalid_syntax]<a class="headerlink" href="#invalid-syntax-class-uri-errc-uri-syntax-invalid-syntax" title="Permalink to this headline">¶</a></h4>
<p>This error is set when the parser is unable to parse the given URI
string.</p>
</div>
</div>
<div class="section" id="uri-reference-and-resolution-errors-class-uri-errc-rar">
<span id="uri-reference-and-resolution-errors"></span><h3>10.2 URI Reference and Resolution Errors [class.uri_errc.rar]<a class="headerlink" href="#uri-reference-and-resolution-errors-class-uri-errc-rar" title="Permalink to this headline">¶</a></h3>
<div class="section" id="base-uri-is-empty-class-uri-errc-rar-base-uri-is-empty">
<h4>10.2.1 <tt class="docutils literal"><span class="pre">base_uri_is_empty</span></tt> [class.uri_errc.rar.base_uri_is_empty]<a class="headerlink" href="#base-uri-is-empty-class-uri-errc-rar-base-uri-is-empty" title="Permalink to this headline">¶</a></h4>
<p>This error is set when the base URI passed to <tt class="docutils literal"><span class="pre">make_relative</span></tt> or
<tt class="docutils literal"><span class="pre">resolve</span></tt> is empty.</p>
</div>
<div class="section" id="base-uri-is-not-absolute-class-uri-errc-rar-base-uri-is-not-absolute">
<h4>10.2.2 <tt class="docutils literal"><span class="pre">base_uri_is_not_absolute</span></tt> [class.uri_errc.rar.base_uri_is_not_absolute]<a class="headerlink" href="#base-uri-is-not-absolute-class-uri-errc-rar-base-uri-is-not-absolute" title="Permalink to this headline">¶</a></h4>
<p>This error is set when the base URI passed to <tt class="docutils literal"><span class="pre">make_relative</span></tt> or
<tt class="docutils literal"><span class="pre">resolve</span></tt> is not absolute (it is itself a relative reference).</p>
</div>
<div class="section" id="base-uri-is-opaque-class-uri-errc-rar-base-uri-is-opaque">
<h4>10.2.3 <tt class="docutils literal"><span class="pre">base_uri_is_opaque</span></tt> [class.uri_errc.rar.base_uri_is_opaque]<a class="headerlink" href="#base-uri-is-opaque-class-uri-errc-rar-base-uri-is-opaque" title="Permalink to this headline">¶</a></h4>
<p>This error is set when the base URI passed to <tt class="docutils literal"><span class="pre">make_relative</span></tt> or
<tt class="docutils literal"><span class="pre">resolve</span></tt> is opaque.</p>
</div>
<div class="section" id="base-uri-does-not-match-class-uri-errc-rar-base-uri-does-not-match">
<h4>10.2.4 <tt class="docutils literal"><span class="pre">base_uri_does_not_match</span></tt> [class.uri_errc.rar.base_uri_does_not_match]<a class="headerlink" href="#base-uri-does-not-match-class-uri-errc-rar-base-uri-does-not-match" title="Permalink to this headline">¶</a></h4>
<p>This error is set when the base URI passed to <tt class="docutils literal"><span class="pre">make_relative</span></tt> does
not match the prefix of the URI.</p>
</div>
</div>
<div class="section" id="uri-builder-errors-class-uri-errc-uri-builder">
<h3>10.3 URI Builder Errors [class.uri_errc.uri_builder]<a class="headerlink" href="#uri-builder-errors-class-uri-errc-uri-builder" title="Permalink to this headline">¶</a></h3>
<div class="section" id="invalid-uri-class-uri-errc-uri-builder-invalid-uri">
<h4>10.3.1 <tt class="docutils literal"><span class="pre">invalid_uri</span></tt> [class.uri_errc.uri_builder.invalid_uri]<a class="headerlink" href="#invalid-uri-class-uri-errc-uri-builder-invalid-uri" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> when the builder is unable to
construct a valid URI.</p>
</div>
<div class="section" id="invalid-scheme-class-uri-errc-uri-builder-invalid-scheme">
<h4>10.3.2 <tt class="docutils literal"><span class="pre">invalid_scheme</span></tt> [class.uri_errc.uri_builder.invalid_scheme]<a class="headerlink" href="#invalid-scheme-class-uri-errc-uri-builder-invalid-scheme" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> if the scheme provided is
invalid.</p>
</div>
<div class="section" id="invalid-user-info-class-uri-errc-uri-builder-invalid-user-info">
<h4>10.3.3 <tt class="docutils literal"><span class="pre">invalid_user_info</span></tt> [class.uri_errc.uri_builder.invalid_user_info]<a class="headerlink" href="#invalid-user-info-class-uri-errc-uri-builder-invalid-user-info" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> if the user info provided
is invalid.</p>
</div>
<div class="section" id="invalid-host-class-uri-errc-uri-builder-invalid-host">
<h4>10.3.4 <tt class="docutils literal"><span class="pre">invalid_host</span></tt> [class.uri_errc.uri_builder.invalid_host]<a class="headerlink" href="#invalid-host-class-uri-errc-uri-builder-invalid-host" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> if the host provided is
invalid.</p>
</div>
<div class="section" id="invalid-port-class-uri-errc-uri-builder-invalid-port">
<h4>10.3.5 <tt class="docutils literal"><span class="pre">invalid_port</span></tt> [class.uri_errc.uri_builder.invalid_port]<a class="headerlink" href="#invalid-port-class-uri-errc-uri-builder-invalid-port" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> if the port provided is
invalid.</p>
</div>
<div class="section" id="invalid-path-class-uri-errc-uri-builder-invalid-port">
<h4>10.3.6 <tt class="docutils literal"><span class="pre">invalid_path</span></tt> [class.uri_errc.uri_builder.invalid_port]<a class="headerlink" href="#invalid-path-class-uri-errc-uri-builder-invalid-port" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> if the path provided is
invalid.</p>
</div>
<div class="section" id="invalid-query-class-uri-errc-uri-builder-invalid-query">
<h4>10.3.7 <tt class="docutils literal"><span class="pre">invalid_query</span></tt> [class.uri_errc.uri_builder.invalid_query]<a class="headerlink" href="#invalid-query-class-uri-errc-uri-builder-invalid-query" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> if the query provided is
invalid.</p>
</div>
<div class="section" id="invalid-fragment-class-uri-errc-uri-builder-invalid-fragment">
<h4>10.3.8 <tt class="docutils literal"><span class="pre">invalid_fragment</span></tt> [class.uri_errc.uri_builder.invalid_fragment]<a class="headerlink" href="#invalid-fragment-class-uri-errc-uri-builder-invalid-fragment" title="Permalink to this headline">¶</a></h4>
<p>This error is set by the <tt class="docutils literal"><span class="pre">uri_builder</span></tt> if the fragment provided is
invalid.</p>
</div>
</div>
<div class="section" id="percent-decoding-errors-class-uri-errc-percent-decoding">
<h3>10.4 Percent Decoding Errors [class.uri_errc.percent_decoding]<a class="headerlink" href="#percent-decoding-errors-class-uri-errc-percent-decoding" title="Permalink to this headline">¶</a></h3>
<div class="section" id="not-enough-input-class-uri-errc-percent-decoding-not-enough-input">
<h4>10.4.1 <tt class="docutils literal"><span class="pre">not_enough_input</span></tt> [class.uri_errc.percent_decoding.not_enough_input]<a class="headerlink" href="#not-enough-input-class-uri-errc-percent-decoding-not-enough-input" title="Permalink to this headline">¶</a></h4>
<p>This error is set when not enough input was given to the decoder to be
able to decode the percent encoded string, e.g. <tt class="docutils literal"><span class="pre">%2</span></tt>.</p>
</div>
<div class="section" id="non-hex-input-class-uri-errc-percent-decoding-non-hex-input">
<h4>10.4.2 <tt class="docutils literal"><span class="pre">non_hex_input</span></tt> [class.uri_errc.percent_decoding.non_hex_input]<a class="headerlink" href="#non-hex-input-class-uri-errc-percent-decoding-non-hex-input" title="Permalink to this headline">¶</a></h4>
<p>This error is set when non-hex input is given to the decoder,
e.g. <tt class="docutils literal"><span class="pre">%GG</span></tt>.</p>
</div>
<div class="section" id="conversion-failed-class-uri-errc-percent-decoding-conversion-failed">
<h4>10.4.3 <tt class="docutils literal"><span class="pre">conversion_failed</span></tt> [class.uri_errc.percent_decoding.conversion_failed]<a class="headerlink" href="#conversion-failed-class-uri-errc-percent-decoding-conversion-failed" title="Permalink to this headline">¶</a></h4>
<p>This error is set when the decoder was unable to convert the percent
encoded string, e.g. <tt class="docutils literal"><span class="pre">%80</span></tt>.</p>
</div>
</div>
</div>
<span id="document-issues"></span><div class="section" id="issues">
<span id="id1"></span><h2>Issues<a class="headerlink" href="#issues" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p><strong>Issues</strong></p>
<p><strong>1. Normalization Invariant</strong></p>
<p>At the Chicago meeting, it was strongly suggested that URIs are
always normalized. However, this does not play well when working
with filesystem URIs, especially if they refer to symbolic links
and therefore it makes sense in these circumstances to keep the URI
unnormalized. Therefore, the changes made after the Chicago meeting
have been reverted, and URIs can be left unnormalized. A
<tt class="docutils literal"><span class="pre">normalize</span></tt> member function exists to provide the conversion
explicitly.</p>
<p><strong>2. Scheme-Specific Normalization</strong></p>
<p>There needs to be an extension point in order to allow scheme- and
protocol- specific normalization.</p>
<p><strong>3. empty() vs. is_absolute() vs. is_opaque()</strong></p>
<p>In the minutes to the Chicago meeting, there was a suggestion that
the <tt class="docutils literal"><span class="pre">is_</span></tt> prefix is being applied inconsistently. The current way
is consistent with at least the filesystem proposal, but
clarification should be made with the LEWG.</p>
<p><strong>4. Factory Functions</strong></p>
<p>The <tt class="docutils literal"><span class="pre">make_uri</span></tt> factory functions are free functions, but the LEWG
needs to clarify if they can remain this way or if they should be
static members of <tt class="docutils literal"><span class="pre">uri</span></tt>.</p>
<p><strong>5. Source Template Parameters</strong></p>
<p>The <tt class="docutils literal"><span class="pre">Source</span></tt> template parameters seem overly generic, this will
be taken up with the LEWG.</p>
<p><strong>6. to_string() etc.</strong></p>
<p>A decision needs to be taken in order to determine if the string
accessors [<a class="reference external" href="#uri-accessors-class-uri-members-accessors">class.uri.members.accessors</a>] should be
consistent with <tt class="docutils literal"><span class="pre">std::experimental::filesystem::path</span></tt>, or if they
will be different by design.</p>
<p><strong>7. string_view null-state</strong></p>
<p class="last">The new TS has changed <a class="reference external" href="http://cplusplus.github.io/fundamentals-ts/fundamentals-ts.html#string.view.cons">basic_string_view</a>
so that it has its own null state that can be created by calling
the <tt class="docutils literal"><span class="pre">basic_string_view</span></tt> default constructor. There may be a case
to remove <tt class="docutils literal"><span class="pre">optional</span></tt> from the URI parts accessors. If that were
to happen, the authors of this paper would recommend a more
explicit accessor in <tt class="docutils literal"><span class="pre">basic_string_view</span></tt> to test the null state
than by checking the pointer returned by <tt class="docutils literal"><span class="pre">data()</span></tt>.</p>
</div>
</div>
<span id="document-acknowledgements"></span><div class="section" id="acknowledgements">
<span id="id1"></span><h2>Acknowledgements<a class="headerlink" href="#acknowledgements" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>C++ Network Library users and mailing list</p>
<p>Kyle Kloepper and Niklas Gustafsson for providing valuable feedback
and encouragement, and for presenting different versions of this
proposal at committee meetings.</p>
<p>The BSI C++ panel for their guidance and patience in reviewing
every draft of this proposal.</p>
<p>Beman Dawes and his Filesystem proposal from which I was influenced
strongly in the class design.</p>
<p>Thiago Macieira and Daniel Kruegler for important feedback on the
draft proposal.</p>
<p>David Thaler for suggesting corrections to errors in referencing
IETF standards.</p>
<p class="last">Wikipedia, for being there.</p>
</div>
</div>
</div>
</div>


          </div>
      </div>

      <div class="clearer"></div>
    </div>
    <div class="footer">
    </div>
  </body>
</html>