gsl::span и boost::ranges
От: dolgop8791  
Дата: 14.01.16 15:04
Оценка:
Пытаюсь использовать их вместе, а они не хотят дружить. Boost версии 1.57, gsl — последний отсюда. На:

unsigned int array[] {0, 1, 2};
gsl::span<unsigned int> my_span = gsl::span<unsigned int> (&array[0], 2);
my_span | boost::adaptors::indexed ();


получаем на vs15 ругань по поводу последней строки:

error C2440: 'return': cannot convert from 'gsl::contiguous_span_iterator<gsl::span<unsigned int,-1>>' to 'gsl::contiguous_span_iterator<gsl::span<const unsigned int,-1>>'
1> boost/range/end.hpp(48): note: No constructor could take the source type, or constructor overload resolution was ambiguous
1> boost/range/end.hpp(105): note: see reference to function template instantiation 'gsl::contiguous_span_iterator<gsl::span<const unsigned int,-1>> boost::range_detail::range_end<const T>(C &)' being compiled
1> with
1> [
1> T=gsl::span<unsigned int,-1>,
1> C=gsl::span<unsigned int,-1>
1> ]
1> boost/range/concepts.hpp(300): note: see reference to function template instantiation 'gsl::contiguous_span_iterator<gsl::span<const unsigned int,-1>> boost::range_adl_barrier::end<gsl::span<unsigned int,-1>>(const T &)' being compiled
1> with
1> [
1> T=gsl::span<unsigned int,-1>
1> ]


В бусте на это такой комментарий:

        template< typename C >
        inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
        range_end( C& c )
        {
            //
            // If you get a compile-error here, it is most likely because
            // you have not implemented range_begin() properly in
            // the namespace of C
            //
            return c.end();
        }


Интересно кто же не прав — вижуальник, буст, gsl и что с этим можно поделать.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.