From 32baddc0b2eebe7c4798417dc2371600a5206956 Mon Sep 17 00:00:00 2001 From: Username404 Date: Mon, 27 Dec 2021 21:46:25 +0100 Subject: [PATCH] Improve the tok constructors --- src/headers/lex.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/headers/lex.hpp b/src/headers/lex.hpp index c2eb211..fcb73fe 100644 --- a/src/headers/lex.hpp +++ b/src/headers/lex.hpp @@ -19,9 +19,9 @@ struct tok { }; const type toktype; const std::string toktext; - const unsigned long line = 0; - tok(type Type, std::string_view Text, decltype(line) line): toktype(Type), toktext(Text), line(line) {} - explicit tok(type Type, decltype(line) line): tok(Type, std::string(1, Type), line) {}; + const unsigned long line; + tok(const type& Type, std::string_view Text, const decltype(line)& line = 0): toktype(Type), toktext(Text), line(line) {} + explicit tok(const type& Type, const decltype(line)& line = 0): tok(Type, std::string(1, Type), line) {}; friend std::ostream& operator<<(std::ostream& output, const tok& it) { return output << it.toktext; } }; std::vector lex(const std::string& in);