boost::urls::decoded_size

Return the buffer size needed for percent‐decoding

Synopsis

Declared in <boost/url/decode.hpp>

system::result<std::size_t>
decoded_size(core::string_view s) noexcept;

Description

This function returns the exact number of bytes needed to store the decoded form of the specified string using the given options. The string is validated before the size is computed; malformed escapes cause the returned result to contain an error instead.

Example

auto n = decoded_size( "My%20Stuff" );
assert( n && *n == 8 );

Exception Safety

Throws nothing. Validation errors are reported in the returned result.

Return Value

A result containing the decoded size, excluding any null terminator.

Parameters

Name Description

s

The string to measure.

See Also