From 92f2284940af54879d48942007ef96e2a6b04581 Mon Sep 17 00:00:00 2001 From: Max SCHMELLER Date: Mon, 2 Sep 2024 17:27:23 +0900 Subject: [PATCH] chore(nebula_common): add utility to get std::string from < +#include +#include +#include + +namespace nebula::util +{ + +template +struct IsStreamable : std::false_type +{ +}; + +template +struct IsStreamable() << std::declval())> > +: std::true_type +{ +}; + +template +std::enable_if_t::value, std::string> to_string(const T & value) +{ + std::stringstream ss{}; + ss << value; + return ss.str(); +} + +} // namespace nebula::util