Skip to content

Commit a45c85d

Browse files
daantimmernomevasnomenasCopilot
authored
fix: resolve runtime static initialization order dependencies (#254) (#258)
Co-authored-by: Naum Puroski <[email protected]> Co-authored-by: Naum Puroski <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 52d8a5d commit a45c85d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cucumber_cpp/library/tag_expression/Token.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ namespace cucumber_cpp::library::tag_expression
3333

3434
struct Token
3535
{
36-
constexpr Token(std::string keyword, std::int32_t precedence, std::optional<Associative> associative, TokenType type = TokenType::operand)
37-
: keyword{ std::move(keyword) }
36+
constexpr Token(std::string_view keyword, std::int32_t precedence, std::optional<Associative> associative, TokenType type = TokenType::operand)
37+
: keyword{ keyword }
3838
, precedence{ precedence }
3939
, associative{ associative }
4040
, type{ type }
@@ -47,17 +47,17 @@ namespace cucumber_cpp::library::tag_expression
4747

4848
bool operator==(const Token& other) const = default;
4949

50-
std::string keyword;
50+
std::string_view keyword;
5151
std::int32_t precedence;
5252
std::optional<Associative> associative;
5353
TokenType type;
5454
};
5555

56-
inline const Token OR{ "or", 0, Associative::left, TokenType::operator_ };
57-
inline const Token AND{ "and", 1, Associative::left, TokenType::operator_ };
58-
inline const Token NOT{ "not", 2, Associative::right, TokenType::operator_ };
59-
inline const Token OPEN_PARENTHESIS{ "(", -2, std::nullopt };
60-
inline const Token CLOSE_PARENTHESIS{ ")", -1, std::nullopt };
56+
static constexpr Token OR{ "or", 0, Associative::left, TokenType::operator_ };
57+
static constexpr Token AND{ "and", 1, Associative::left, TokenType::operator_ };
58+
static constexpr Token NOT{ "not", 2, Associative::right, TokenType::operator_ };
59+
static constexpr Token OPEN_PARENTHESIS{ "(", -2, std::nullopt };
60+
static constexpr Token CLOSE_PARENTHESIS{ ")", -1, std::nullopt };
6161

6262
inline const std::map<std::string_view, const Token&>& TokenMap()
6363
{

0 commit comments

Comments
 (0)