Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
constant_string_view::constant_string_view

Consteval constructor.

Synopsis
template<
    class T>
consteval
constant_string_view(
    const T& value);
Description

Constructs a string_view from the passed argument.

This function is consteval: it results in a compile-time error if the passed value is not known at compile-time. You can bypass this check using the runtime function. This check works only for C++20 and above. No check is performed for lower C++ standard versions.

This constructor is only considered if a string_view can be constructed from the passed value.

Exception safety

No-throw guarantee.

Object lifetimes

Ownership is not transferred to the constructed object. As with string_view, the user is responsible for keeping the original character buffer alive.


PrevUpHomeNext