From 160c5835287993cdafacbb3f42d6bec64ac4c6c1 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 9 Jul 2025 11:42:58 +0200 Subject: fix: Fix compiler errors regarding the `fix` module. Signed-off-by: Amlal El Mahrouss --- lib/fix/parser.hpp | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'lib/fix') diff --git a/lib/fix/parser.hpp b/lib/fix/parser.hpp index 018648e..d4fc704 100644 --- a/lib/fix/parser.hpp +++ b/lib/fix/parser.hpp @@ -29,22 +29,25 @@ namespace snu::fix namespace detail { - template - inline constexpr auto begin_fix() -> const char* + template + const char_type* begin_fix(); + + template <> + inline const char* begin_fix() { - return "8=FIX."; + return "FIX."; } - template - inline constexpr auto begin_fix() -> const char16_t* + template <> + inline const char16_t* begin_fix() { - return u"8=FIX."; + return u"FIX."; } - template - inline constexpr auto begin_fix() -> const char8_t* + template <> + inline const char8_t* begin_fix() { - return u8"8=FIX."; + return u8"FIX."; } } // namespace detail @@ -59,7 +62,10 @@ namespace snu::fix return ascii_bytes_ && length_ > 0; } - operator bool() { return this->is_valid(); } + operator bool() + { + return this->is_valid(); + } }; /// @brief Convert range to usable string. @@ -81,7 +87,7 @@ namespace snu::fix std::size_t msg_body_len_; std::vector, std::basic_string>> msg_body_; - static constexpr char_type* begin = detail::begin_fix(); + static inline const char_type* begin = detail::begin_fix(); explicit range_data() = default; ~range_data() = default; @@ -91,10 +97,13 @@ namespace snu::fix bool is_valid() { - return !msg_magic_.empty() && msg_magic_.starts_with(range_data::begin); + return msg_magic_.starts_with(range_data::begin); } - operator bool() { return this->is_valid(); } + operator bool() + { + return this->is_valid(); + } }; /// @brief visitor object which returns a fix::range_data instance. @@ -111,10 +120,10 @@ namespace snu::fix visitor& operator=(const visitor&) = default; visitor(const visitor&) = default; - range_data visit(const std::string& in) + range_data visit(const std::basic_string& in) { - thread_local range_data ret{}; - thread_local std::string in_tmp{}; + thread_local range_data ret{}; + thread_local std::basic_string in_tmp{}; in_tmp.reserve(in.size()); -- cgit v1.2.3