diff --git a/include/stdx/ct_string.hpp b/include/stdx/ct_string.hpp index 5f6566d..4fd21b5 100644 --- a/include/stdx/ct_string.hpp +++ b/include/stdx/ct_string.hpp @@ -157,6 +157,16 @@ constexpr auto operator+(cts_t, cts_t) { return cts_t{}; } +template +[[nodiscard]] constexpr auto operator+(ct_string const &lhs, cts_t rhs) { + return lhs + +rhs; +} + +template +[[nodiscard]] constexpr auto operator+(cts_t lhs, ct_string const &rhs) { + return +lhs + rhs; +} + namespace detail { template struct ct_helper>; } // namespace detail diff --git a/test/ct_string.cpp b/test/ct_string.cpp index 666da69..756400b 100644 --- a/test/ct_string.cpp +++ b/test/ct_string.cpp @@ -159,3 +159,9 @@ TEST_CASE("cts_t can implicitly convert to ct_string", "[ct_string]") { using namespace stdx::ct_string_literals; STATIC_REQUIRE(conversion_success<"Hello"_ctst>); } + +TEST_CASE("operator+ works to concat cts_t and ct_string", "[ct_string]") { + using namespace stdx::ct_string_literals; + STATIC_REQUIRE("Hello"_ctst + " world"_cts == "Hello world"_cts); + STATIC_REQUIRE("Hello"_cts + " world"_ctst == "Hello world"_cts); +}