option: rename to to_string_opt and to_string_view_opt

to_option_string -> to_string_opt
to_string_view   -> to_string_view_opt
This commit is contained in:
Dirk-Jan C. Binnema
2022-04-16 13:16:29 +03:00
parent 4f9c154d1a
commit 7c51bc68d4
9 changed files with 104 additions and 77 deletions

View File

@ -174,22 +174,22 @@ std::string date_to_time_t_string(int64_t t);
std::string time_to_string(const std::string& frm, time_t t, bool utc = false) G_GNUC_CONST;
/**
* Create a std::string by consuming a gchar* array; this takes ownership
* of str which should no longer be used.
*
* @param str a gchar* or NULL (latter taken as "")
*
* @return a std::string
*/
static inline std::string
from_gchars(gchar*&& str)
{
std::string s{str ? str : ""};
g_free(str);
// /**
// * Create a std::string by consuming a gchar* array; this takes ownership
// * of str which should no longer be used.
// *
// * @param str a gchar* or NULL (latter taken as "")
// *
// * @return a std::string
// */
// static inline std::string
// from_gchars(gchar*&& str)
// {
// std::string s{str ? str : ""};
// g_free(str);
return s;
}
// return s;
// }
// https://stackoverflow.com/questions/19053351/how-do-i-use-a-custom-deleter-with-a-stdunique-ptr-member
template <auto fn>