[#boost-urls-grammar-ref-0e]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/grammar.adoc[grammar]::ref
:relfileprefix: ../../../
:mrdocs:


Return a reference to a rule

== Synopsis


Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/parse.hpp#L102[boost&sol;url&sol;grammar&sol;parse&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;xref:boost/urls/grammar/Rule.adoc[Rule] R&gt;
constexpr
&sol;&ast; implementation-defined &ast;&sol;::xref:boost/urls/grammar/implementation_defined/rule_ref.adoc[rule&lowbar;ref]&lt;R&gt;
ref(R const& r) noexcept
requires is&lowbar;rule&lt;R&gt;&colon;&colon;value &amp;&amp;
    ! std&colon;&colon;is&lowbar;same&lt;R,
        implementation&lowbar;defined&colon;&colon;rule&lowbar;ref&lt;R&gt; &gt;&colon;&colon;value;
----

== Description


This function returns a rule which    references the specified object&period; This is    used to reduce the number of bytes of    storage (`sizeof`) required by a combinator    when it stores a copy of the object&period;        Ownership of the object is not transferred&semi;    the caller is responsible for ensuring the    lifetime of the object is extended until it    is no longer referenced&period; For best results,    `ref` should only be used with compile&hyphen;time    constants&period;



== Parameters


|===
| Name | Description

| *r*
| The rule to use


|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
