From: Enrico Forestieri Date: Tue, 21 Dec 2010 14:52:18 +0000 (+0000) Subject: Avoid const casts by making mutable the usermacros member. X-Git-Tag: 2.0.0~1281 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=89c1d25250fca0292e066b501c23e02bca3885c4;p=features.git Avoid const casts by making mutable the usermacros member. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36984 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index a046124250..ea5b6e57ae 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -822,7 +822,7 @@ bool Buffer::readDocument(Lexer & lex) // inform parent buffer about local macros if (parent()) { - Buffer * pbuf = const_cast(parent()); + Buffer const * pbuf = parent(); UserMacroSet::const_iterator cit = usermacros.begin(); UserMacroSet::const_iterator end = usermacros.end(); for (; cit != end; ++cit) diff --git a/src/Buffer.h b/src/Buffer.h index d0d787687c..5819466bf7 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -544,7 +544,7 @@ public: /// Collect user macro names at loading time typedef std::set UserMacroSet; - UserMacroSet usermacros; + mutable UserMacroSet usermacros; /// Replace the inset contents for insets which InsetCode is equal /// to the passed \p inset_code. diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index bdb332d9d6..e1e61b15c4 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -463,7 +463,7 @@ Buffer * InsetInclude::loadIfNeeded() const } else { // The file was already loaded, so, simply // inform parent buffer about local macros. - Buffer * parent = const_cast(&buffer()); + Buffer const * parent = &buffer(); child->setParent(parent); MacroNameSet macros; child->listMacroNames(macros);