
"Pavel Kuznetsov" <pavel@despammed.com> writes:
David,
Ok, I got your point. But maybe then it might be a good idea to add some kind of compile-time assert to boost::dereferenceable<>::operator->()?
I'd be happy to evaluate your patch containing an assert.
Here it is.
Looks way too heavy to me for what it's accomplishing. How about: namespace error { template <class T, class Value> int dereferenceable_requires_lvalue_dereference(Value&); } template <class T, class P, class B = ::boost::detail::empty_base> struct dereferenceable : B { P operator->() const { enum { assertion = sizeof( error::dereferenceable_requires_lvalue_dereference<T>( *static_cast<const T&>(*this) )) }; return &*static_cast<const T&>(*this); } }; ?? Does that work? -- Dave Abrahams Boost Consulting http://www.boost-consulting.com