mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c++: use modern idioms to make classes non-copyable
Reported by Don Macpherson. https://lists.gnu.org/r/bug-bison/2019-05/msg00015.html https://github.com/akimd/bison/issues/36 * data/skeletons/lalr1.cc, data/skeletons/stack.hh, * data/skeletons/variant.hh: Delete the copy-ctor and the copy operator.
This commit is contained in:
@@ -41,6 +41,13 @@ m4_define([b4_stack_define],
|
||||
: seq_ (n)
|
||||
{}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Non copyable.
|
||||
stack (const stack&) = delete;
|
||||
/// Non copyable.
|
||||
stack& operator= (const stack&) = delete;
|
||||
#endif
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
@@ -126,8 +133,12 @@ m4_define([b4_stack_define],
|
||||
};
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Non copyable.
|
||||
stack (const stack&);
|
||||
/// Non copyable.
|
||||
stack& operator= (const stack&);
|
||||
#endif
|
||||
/// The wrapped container.
|
||||
S seq_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user