Return the buffer size needed for percent-encoding

Synopsis

Declared in header </boost/url/encode.hpp#L62[boost/url/encode.hpp,window=blank_]>

template<class CharSet>
size_t
encoded_size(
    string_view s,
    const CharSet& unreserved,
    encoding_opts opt = = {}) noexcept;

Description

This function returns the exact number of bytes necessary to store the result of applying percent-encoding to the string using the given options and character set. No encoding is actually performed.

Example

assert( encoded_size( "My Stuff", pchars ) == 10 );

Exception Safety

Throws nothing.

Return Value

  • size_t

Parameters

Name Type

s

string_view

unreserved

``

opt

encoding_opts