PrevUpHomeNext

Function template object_of

boost::mixin::object_of — gets the object of a mixin

Synopsis

// In header: <boost/mixin/mixin.hpp>


template<typename Mixin> const object * object_of(const Mixin * mixin_addr);

Description

Returns the owning object of a given mixin.

[Warning] Warning

This function just makes a pointer offset and cast. It will work with any object that's been given to it without a warning or an error. Even, say int*. It is a source of potential bugs if you don't make sure that the input pointer is a mixin, that is a part of an object

Example: 

mymixin* ptr = myobject->get<mymixin>();
object_of(ptr); // == myobject

See Also:

bm_this

Parameters:

mixin_addr

the address of the mixin

Returns:

A pointer to the object of the given mixin


PrevUpHomeNext