mail[Wesnoth-commits] r44587 - in /trunk/src: variable.cpp variable.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on July 23, 2010 - 16:43:
Author: silene
Date: Fri Jul 23 16:43:40 2010
New Revision: 44587

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44587&view=rev
Log:
Avoided copies.

Modified:
    trunk/src/variable.cpp
    trunk/src/variable.hpp

Modified: trunk/src/variable.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.cpp?rev=44587&r1=44586&r2=44587&view=diff
==============================================================================
--- trunk/src/variable.cpp (original)
+++ trunk/src/variable.cpp Fri Jul 23 16:43:40 2010
@@ -415,7 +415,7 @@
        return key;
 }
 
-const vconfig vconfig::all_children_iterator::get_child() const
+vconfig vconfig::all_children_iterator::get_child() const
 {
        if (i_->key == "insert_tag")
        {
@@ -435,14 +435,9 @@
        return vconfig(&i_->cfg, cache_key_);
 }
 
-bool vconfig::all_children_iterator::operator==(all_children_iterator i) 
const
-{
-       return (i_ == i.i_ && inner_index_ == i.inner_index_);
-}
-
-bool vconfig::all_children_iterator::operator!=(all_children_iterator i) 
const
-{
-       return (i_ != i.i_ || inner_index_ != i.inner_index_);
+bool vconfig::all_children_iterator::operator==(const all_children_iterator 
&i) const
+{
+       return i_ == i.i_ && inner_index_ == i.inner_index_;
 }
 
 vconfig::all_children_iterator vconfig::ordered_begin() const

Modified: trunk/src/variable.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.hpp?rev=44587&r1=44586&r2=44587&view=diff
==============================================================================
--- trunk/src/variable.hpp (original)
+++ trunk/src/variable.hpp Fri Jul 23 16:43:40 2010
@@ -79,7 +79,7 @@
        {
                struct pointer_proxy;
 
-               typedef std::pair<const std::string, const vconfig> 
value_type;
+               typedef std::pair<std::string, vconfig> value_type;
                typedef std::forward_iterator_tag iterator_category;
                typedef int difference_type;
                typedef const pointer_proxy pointer;
@@ -94,10 +94,11 @@
                pointer operator->() const;
 
                std::string get_key() const;
-               const vconfig get_child() const;
-
-               bool operator==(all_children_iterator i) const;
-               bool operator!=(all_children_iterator i) const;
+               vconfig get_child() const;
+
+               bool operator==(const all_children_iterator &i) const;
+               bool operator!=(const all_children_iterator &i) const
+               { return !operator==(i); }
 
        private:
                Itor i_;




Related Messages


Powered by MHonArc, Updated Fri Jul 23 18:00:13 2010