2014/1/10 Sebastian Pfützner <s.pfuetzner@onlinehome.de>
On 09.01.2014 17:43, Krzysztof Czainski wrote:
That said, here's a hack for you: right after the definition of struct S
insert this code:

class It;

namespace boost { namespace detail {
template <> struct operator_brackets_result<It,S,S&>
{ typedef S& type; };
}}

That works in the example. In my real code, /It/ is a template and I don't know how to specialize operator_brackets_result for each instantiation.

It should be possible to write a partial specialization of operator_brackets_result<> for the whole template It.

For example:

template < class T > class It;

namespace boost { namespace detail {
template < class T > struct operator_brackets_result<It<T>,T,T&>
{ typedef T& type; };
}}

Regards
Kris