Author: sapient
Date: Fri Jul 25 17:13:03 2008
New Revision: 28185
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28185&view=rev
Log:
a comment explaining vconfig::operator[]'s return type, as requested by Mordante
Modified:
trunk/src/variable.hpp
Modified: trunk/src/variable.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.hpp?rev=28185&r1=28184&r2=28185&view=diff
==============================================================================
--- trunk/src/variable.hpp (original)
+++ trunk/src/variable.hpp Fri Jul 25 17:13:03 2008
@@ -51,8 +51,12 @@
vconfig child(const std::string& key) const;
bool has_child(const std::string& key) const;
+ /* Note: vconfig::operator[] returns const, and this should not be
changed
+ because vconfig is often used as a drop-in replacement for config,
and
+ this const will properly warn you if you try to assign
vcfg["key"]=val;
+ */
+ const t_string operator[](const std::string& key) const { return
expand(key); }
const t_string expand(const std::string&) const; /** < Synonym for
operator[] */
- const t_string operator[](const std::string& key) const { return
expand(key); }
const t_string& get_attribute(const std::string& key) const { return
(*cfg_)[key]; }
bool has_attribute(const std::string& key) const { return
cfg_->has_attribute(key); }
bool empty() const { return (null() || cfg_->empty()); }
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits