string_holder class
#include <gtopt/as_label.hpp>
String holder that avoids heap allocation for integral and string_view arguments. Integer values are formatted into a small stack buffer. Only the std::format fallback path allocates on the heap.
Uses a tag to track which storage is active, computing the view on demand in view(). This avoids self-referential pointers that would break on move/copy.
Constructors, destructors, conversion operators
- string_holder(const T& value) explicit
- string_holder(const T& value) explicit noexcept
- string_holder(std::string&& s) explicit noexcept
Public functions
- auto string_holder(const std::string& s) -> constexpr explicit noexcept
-
template<string_like T>auto string_holder(T&& value) -> constexpr explicit noexcept
- auto view() const -> constexpr std::string_view noexcept