Dirk Reiners wrote:
> Yup. I've had that request (with the same pointer towards boost) from
> Chad, but I haven't had time to look into it. If you're willing to take
> a shot I'd be happy to commit it.
Here it goes.
The addition to OSGFieldContainerPtrImpl.h is:
typedef UInt8 * FieldContainerPtrBase::*unspecified_bool_type;
operator unspecified_bool_type() const;
And OSGFieldContainerPtrImpl.inl:
operator unspecified_bool_type() const
{
return !*this ? 0 : &FieldContainerPtrBase::_storeP;
}
This works nicely for me (visual 7.1). I'm not sure about which other
compilers you want to support. Aaccording to boost sources (excerpt
below) the some versions of metrowerks and sunpro seems to have issues
with the default implementation I propose here. I'm sure the workarounds
they use would be useable in OpenSG as well, but I do not have access to
any other compilers.
> I'm all for cute if it makes life easier for the users (if you want
> cuddly animals in the code I might have a problem ;).
Perhaps 'Teach Yourself Ascii-Furries in 10 hours' is on eBay? :)
/Marcus
------
For reference, the boost code is:
// implicit conversion to "bool"
#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
operator bool () const
{
return px != 0;
}
#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__,
BOOST_TESTED_AT(0x3003))
typedef T * (this_type::*unspecified_bool_type)() const;
operator unspecified_bool_type() const // never throws
{
return px == 0? 0: &this_type::get;
}
#else
typedef T * this_type::*unspecified_bool_type;
operator unspecified_bool_type() const // never throws
{
return px == 0? 0: &this_type::px;
}
#endif
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users