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).



[SVN r39285]
This commit is contained in:
Douglas Gregor
2007-09-14 21:05:46 +00:00
parent 3312c7ffcd
commit 53b95c386d
2 changed files with 5 additions and 9 deletions

View File

@ -478,7 +478,6 @@ namespace boost {
*/ */
struct vtable_base struct vtable_base
{ {
vtable_base() : manager(0) { }
void (*manager)(const function_buffer& in_buffer, void (*manager)(const function_buffer& in_buffer,
function_buffer& out_buffer, function_buffer& out_buffer,
functor_manager_operation_type op); functor_manager_operation_type op);

View File

@ -434,8 +434,8 @@ namespace boost {
void clear(function_buffer& functor) const void clear(function_buffer& functor) const
{ {
if (manager) if (base.manager)
manager(functor, functor, destroy_functor_tag); base.manager(functor, functor, destroy_functor_tag);
} }
private: private:
@ -538,9 +538,7 @@ namespace boost {
} }
public: public:
void (*manager)(const function_buffer& in_buffer, vtable_base base;
function_buffer& out_buffer,
functor_manager_operation_type op);
invoker_type invoker; invoker_type invoker;
}; };
} // end namespace function } // end namespace function
@ -780,10 +778,9 @@ namespace boost {
typedef typename handler_type::manager_type manager_type; typedef typename handler_type::manager_type manager_type;
static const vtable_type stored_vtable = 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)) if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable.base;
vtable = reinterpret_cast<const vtable_base*>(&stored_vtable);
else vtable = 0; else vtable = 0;
} }
}; };