mail[Wesnoth-commits] r44580 - 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 - 15:34:
Author: silene
Date: Fri Jul 23 15:34:01 2010
New Revision: 44580

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44580&view=rev
Log:
Removed auto_ptr from proxy iterator.

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=44580&r1=44579&r2=44580&view=diff
==============================================================================
--- trunk/src/variable.cpp (original)
+++ trunk/src/variable.cpp Fri Jul 23 15:34:01 2010
@@ -399,10 +399,12 @@
        return std::make_pair<const std::string, const vconfig>(get_key(), 
get_child());
 }
 
-vconfig::all_children_iterator::pointer 
vconfig::all_children_iterator::operator->() const
-{
-       return pointer(new std::pair<const std::string, const 
vconfig>(get_key(), get_child()));
-}
+vconfig::all_children_iterator::pointer_proxy 
vconfig::all_children_iterator::operator->() const
+{
+       pointer_proxy p = { value_type(get_key(), get_child()) };
+       return p;
+}
+
 
 std::string vconfig::all_children_iterator::get_key() const
 {

Modified: trunk/src/variable.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.hpp?rev=44580&r1=44579&r2=44580&view=diff
==============================================================================
--- trunk/src/variable.hpp (original)
+++ trunk/src/variable.hpp Fri Jul 23 15:34:01 2010
@@ -79,7 +79,7 @@
                typedef std::pair<const std::string, const vconfig> 
value_type;
                typedef std::forward_iterator_tag iterator_category;
                typedef int difference_type;
-               typedef std::auto_ptr<value_type> pointer;
+               typedef const value_type *pointer;
                typedef value_type& reference;
                typedef config::all_children_iterator Itor;
                explicit all_children_iterator(const Itor &i, const config 
*cache_key = NULL);
@@ -87,8 +87,10 @@
                all_children_iterator& operator++();
                all_children_iterator  operator++(int);
 
+               struct pointer_proxy;
+
                value_type operator*() const;
-               pointer operator->() const;
+               pointer_proxy operator->() const;
 
                std::string get_key() const;
                const vconfig get_child() const;
@@ -114,6 +116,12 @@
 private:
        const config* cfg_;
        const config* cache_key_;
+};
+
+struct vconfig::all_children_iterator::pointer_proxy
+{
+       value_type p;
+       pointer operator->() const { return &p; }
 };
 
 namespace variable




Related Messages


Powered by MHonArc, Updated Fri Jul 23 16:40:14 2010