This will make it possible to have functions that accept CStringViews:
void foo(CStringView);
and pass in std::strings seamlessly:
foo(myStdStr);
Change-Id: I76dc55438c2cd87f77ddec421dff7f119e53eff5
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11688
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
{
}
+ /*
+ * Builds a view of the string `str`.
+ *
+ * Intentionally not explicit.
+ */
+ CStringView(const std::string& str) noexcept : _mStr {str.c_str()}
+ {
+ }
+
/*
* Makes this view view the C string `str` (may be `nullptr`).
*