Stopped memory leak with transferring tokens

This commit is contained in:
Pasha Bibko
2025-07-23 18:22:24 +01:00
parent 783d259995
commit 6a534ba635
2 changed files with 36 additions and 4 deletions

View File

@@ -92,6 +92,16 @@ namespace LXC::Lexer
// Constructor to set the data of the token for more complex token types //
Token(const LexerContext& ctx, uint32_t start, unsigned short len, TokenType _type);
// Copy constructor //
Token(const Token& other);
// Move constructor (transfers memory allocated) //
Token(Token&& other) noexcept;
// Cannot use these as members are const //
Token& operator=(const Token&) = delete;
Token& operator=(Token&&) = delete;
// Deconstructor to clean up the allocated memory //
~Token();