mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
cppparser: Allow move semantics for CPPToken
This should make it a bit more efficient to move tokens around
This commit is contained in:
parent
e1870047c6
commit
12a188b116
@ -410,7 +410,7 @@ preprocess_file(const Filename &filename) {
|
||||
// Switched to a new file, reset the line number.
|
||||
line_number = 0;
|
||||
}
|
||||
token = next_token;
|
||||
token = std::move(next_token);
|
||||
}
|
||||
std::cout << "\n";
|
||||
|
||||
@ -501,7 +501,7 @@ get_next_token0() {
|
||||
|
||||
CPPToken token(0);
|
||||
if (!_saved_tokens.empty()) {
|
||||
token = _saved_tokens.back();
|
||||
token = std::move(_saved_tokens.back());
|
||||
_saved_tokens.pop_back();
|
||||
} else {
|
||||
token = internal_get_next_token();
|
||||
|
@ -46,29 +46,6 @@ CPPToken(int token, const YYLTYPE &loc, const std::string &str, const YYSTYPE &v
|
||||
_lval.str = str;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CPPToken::
|
||||
CPPToken(const CPPToken ©) :
|
||||
_token(copy._token),
|
||||
_lloc(copy._lloc)
|
||||
{
|
||||
_lval.str = copy._lval.str;
|
||||
_lval.u = copy._lval.u;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void CPPToken::
|
||||
operator = (const CPPToken ©) {
|
||||
_token = copy._token;
|
||||
_lval.str = copy._lval.str;
|
||||
_lval.u = copy._lval.u;
|
||||
_lloc = copy._lloc;
|
||||
}
|
||||
|
||||
/**
|
||||
* A named constructor for the token returned when the end of file has been
|
||||
* reached.
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
CPPToken(int token, const YYLTYPE &loc,
|
||||
const std::string &str = std::string(),
|
||||
const YYSTYPE &lval = YYSTYPE());
|
||||
CPPToken(const CPPToken ©);
|
||||
void operator = (const CPPToken ©);
|
||||
|
||||
static CPPToken eof();
|
||||
bool is_eof() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user