Opened 10 years ago

Closed 4 years ago

Last modified 4 years ago

#7189 closed Bugs (duplicate)

[gil] conflict between boost range and boost gil

Reported by: kaischroeder3@… Owned by: Stefan Seefeld
Milestone: To Be Determined Component: gil USE GITHUB
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc: mateusz@…

Description (last modified by Mateusz Loskot)

The following does not compile because it cannot be resolved whether a call to boost::range::fill_n or std::fill_n is correct

#include <boost/array.hpp>
#include <boost/gil/image_view.hpp>
#include <boost/gil/image.hpp>
#include <boost/gil/typedefs.hpp>

#include <boost/range/algorithm/fill_n.hpp>

namespace gil = boost::gil;

int main( int argc, char** argv)
{
    gil::image<boost::array<float,2> > img;

    std::fill( gil::view(img).begin(), gil::view(img).end(), boost::array<float,2>() );
}

Error:

[100%] Building CXX object CMakeFiles/test_misc.dir/test_misc.cpp.o
In file included from /usr/include/boost/gil/image.hpp:29:0,
                 from /media/data2TB/data_win/Code/weavepattern/ActiveGrid/tests/test_misc.cpp:3:
/usr/include/boost/gil/algorithm.hpp: In function ‘void std::fill(boost::gil::iterator_from_2d<IL>, boost::gil::iterator_from_2d<IL>, const V&) [with IL = boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::array<float, 2ul>*> >, V = boost::array<float, 2ul>]’:
/media/data2TB/data_win/Code/weavepattern/ActiveGrid/tests/test_misc.cpp:14:86:   instantiated from here
/usr/include/boost/gil/algorithm.hpp:382:13: error: call of overloaded ‘fill_n(boost::array<float, 2ul>*&, std::ptrdiff_t&, const boost::array<float, 2ul>&)’ is ambiguous
/usr/include/boost/gil/algorithm.hpp:382:13: note: candidates are:
/usr/include/c++/4.6/bits/stl_algobase.h:775:5: note: _OI std::fill_n(_OI, _Size, const _Tp&) [with _OI = boost::array<float, 2ul>*, _Size = long int, _Tp = boost::array<float, 2ul>]
/usr/include/boost/range/algorithm/fill_n.hpp:31:22: note: ForwardRange& boost::range::fill_n(ForwardRange&, Size, const Value&) [with ForwardRange = boost::array<float, 2ul>*, Size = long int, Value = boost::array<float, 2ul>]
/usr/include/boost/range/algorithm/fill_n.hpp:41:28: note: const ForwardRange& boost::range::fill_n(const ForwardRange&, Size, const Value&) [with ForwardRange = boost::array<float, 2ul>*, Size = long int, Value = boost::array<float, 2ul>]
make[3]: *** [CMakeFiles/test_misc.dir/test_misc.cpp.o] Error 1

Change History (6)

comment:1 by anonymous, 10 years ago

I should add: This is on Ubuntu 12.04 using gcc 4.6

comment:2 by Mateusz Loskot, 6 years ago

Cc: mateusz@… added
Description: modified (diff)

comment:3 by Stefan Seefeld, 5 years ago

Owner: changed from Hailin Jin to Stefan Seefeld

comment:4 by Mateusz Loskot, 4 years ago

Would this simple change help?

Line algorithm.hpp:377 from

fill_n(first.x(), numToDo, val);

to

::std::fill_n(first.x(), numToDo, val);

comment:5 by Mateusz Loskot, 4 years ago

Resolution: duplicate
Status: newclosed

comment:6 by Mateusz Loskot, 4 years ago

FYI, the patch has been merged into Boos.GIL and should be released in Boost 1.69

https://github.com/boostorg/gil/pull/152

Thanks!

Note: See TracTickets for help on using tickets.