Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2007-09-14 17:05:46


Author: dgregor
Date: 2007-09-14 17:05:46 EDT (Fri, 14 Sep 2007)
New Revision: 39285
URL: http://svn.boost.org/trac/boost/changeset/39285

Log:
Finalizes the fix to Bug #1260, making vtable_base an actual POD type (oops)
and playing more nicely with reinterpret_cast (thanks to Brad King for the
fixes).

Text files modified:
   trunk/boost/function/function_base.hpp | 1 -
   trunk/boost/function/function_template.hpp | 13 +++++--------
   2 files changed, 5 insertions(+), 9 deletions(-)

Modified: trunk/boost/function/function_base.hpp
==============================================================================
--- trunk/boost/function/function_base.hpp (original)
+++ trunk/boost/function/function_base.hpp 2007-09-14 17:05:46 EDT (Fri, 14 Sep 2007)
@@ -478,7 +478,6 @@
        */
       struct vtable_base
       {
- vtable_base() : manager(0) { }
         void (*manager)(const function_buffer& in_buffer,
                         function_buffer& out_buffer,
                         functor_manager_operation_type op);

Modified: trunk/boost/function/function_template.hpp
==============================================================================
--- trunk/boost/function/function_template.hpp (original)
+++ trunk/boost/function/function_template.hpp 2007-09-14 17:05:46 EDT (Fri, 14 Sep 2007)
@@ -434,8 +434,8 @@
 
         void clear(function_buffer& functor) const
         {
- if (manager)
- manager(functor, functor, destroy_functor_tag);
+ if (base.manager)
+ base.manager(functor, functor, destroy_functor_tag);
         }
 
       private:
@@ -538,9 +538,7 @@
         }
 
       public:
- void (*manager)(const function_buffer& in_buffer,
- function_buffer& out_buffer,
- functor_manager_operation_type op);
+ vtable_base base;
         invoker_type invoker;
       };
     } // end namespace function
@@ -780,10 +778,9 @@
       typedef typename handler_type::manager_type manager_type;
       
       static const vtable_type stored_vtable =
- { &manager_type::manage, &invoker_type::invoke };
+ { { &manager_type::manage }, &invoker_type::invoke };
 
- if (stored_vtable.assign_to(f, functor))
- vtable = reinterpret_cast<const vtable_base*>(&stored_vtable);
+ if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable.base;
       else vtable = 0;
     }
   };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk