gtopt/as_label.hpp file

String label generation utilities.

This module provides compile-time string label generation functionality with:

  • Efficient concatenation of multiple values
  • Type-safe string conversion
  • Custom separator support
  • Move semantics optimization

The main interface is the as_label() function which:

  • Accepts any number of arguments of different types
  • Converts each argument to string representation
  • Joins them with a configurable separator
  • Returns a concatenated std::string

Supported argument types:

  • std::string and string views
  • Built-in numeric types (converted via std::format)
  • Any type convertible to string_view
  • Any type formattable via std::format

Example usage:

auto label1 = as_label("prefix", 42, "suffix"); // "prefix_42_suffix"
auto label2 = as_label<'-'>("a", "b", "c");    // "a-b-c"

Namespaces

namespace gtopt
namespace gtopt::detail

Classes

struct gtopt::detail::IntCacheData
struct gtopt::detail::label_size
class gtopt::detail::string_holder