Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/stdx/ct_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ constexpr auto operator+(cts_t<X>, cts_t<Y>) {
return cts_t<X + Y>{};
}

template <std::size_t N, ct_string S>
[[nodiscard]] constexpr auto operator+(ct_string<N> const &lhs, cts_t<S> rhs) {
return lhs + +rhs;
}

template <ct_string S, std::size_t N>
[[nodiscard]] constexpr auto operator+(cts_t<S> lhs, ct_string<N> const &rhs) {
return +lhs + rhs;
}

namespace detail {
template <std::size_t N> struct ct_helper<ct_string<N>>;
} // namespace detail
Expand Down
6 changes: 6 additions & 0 deletions test/ct_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}