[#boost-urls-grammar-ref-0e] = xref:boost/urls/grammar/ref-0e.adoc[boost::urls::grammar::ref] :relfileprefix: ../../../ :mrdocs: Return a reference to a rule == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/parse.hpp#L103[boost/url/grammar/parse.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:boost/urls/grammar/Rule.adoc[Rule] R> constexpr /* implementation-defined */ ref(R const& r) noexcept requires is_rule<R>::value && ! std::is_same<R, implementation_defined::rule_ref<R> >::value; ---- == Description This function returns a rule which references the specified object. This is used to reduce the number of bytes of storage (`sizeof`) required by a combinator when it stores a copy of the object. Ownership of the object is not transferred; the caller is responsible for ensuring the lifetime of the object is extended until it is no longer referenced. For best results, `ref` should only be used with compile‐time constants. == Return Value The rule as a reference type == Parameters [cols=2] |=== | Name | Description | *r* | The rule to use |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#