gil icon indicating copy to clipboard operation
gil copied to clipboard

scanlne_reader for istream not worked

Open fsmoke opened this issue 4 years ago • 0 comments

Actual behavior

Code not compiles on msvc 16.9.1

see piece of build log below

1>  d:\libraries\boost_1_75_0\boost\gil\io\get_reader.hpp(160,62): error C2039: 'type': is not a member of 'boost::gil::get_read_device<T,FormatTag,void>'
1>          with
1>          [
1>              T=std::ifstream,
1>              FormatTag=boost::gil::image_read_settings<boost::gil::jpeg_tag>
1>          ]
1>  d:\libraries\boost_1_75_0\boost\gil\io\get_reader.hpp(160): message : see declaration of 'boost::gil::get_read_device<T,FormatTag,void>'
1>          with
1>          [
1>              T=std::ifstream,
1>              FormatTag=boost::gil::image_read_settings<boost::gil::jpeg_tag>
1>          ]
1>  d:\libraries\boost_1_75_0\boost\gil\io\make_scanline_reader.hpp(95): message : see reference to class template instantiation 'boost::gil::get_scanline_reader<Device,boost::gil::image_read_settings<boost::gil::jpeg_tag>>' being compiled
1>          with
1>          [
1>              Device=std::ifstream
1>          ]

Expected behavior

I want use gil for read jpeg line by line from istream

C++ Minimal Example

#include <fstream>
#include <boost/gil.hpp>
#include <boost/gil/extension/io/jpeg.hpp>
namespace gil = boost::gil;
int main
{
        using tag_t = gil::jpeg_tag;
	using reader_t = gil::scanline_reader<typename gil::get_read_device<std::istream, tag_t>::type, tag_t>;

	std::ifstream is("d:/test.jpg", std::ios::binary | std::ios::in);
		
	reader_t reader = gil::make_scanline_reader(is, tag_t()); //Here an error
}

Environment

Inside make_scanline_reader.hpp (line 84) - it seems function recursive:

template <typename Device, typename FormatTag>
inline
auto make_scanline_reader(Device& io_dev, FormatTag const&,
    typename std::enable_if
    <
        mp11::mp_and
        <
            detail::is_adaptable_input_device<FormatTag, Device>,
            is_format_tag<FormatTag>
        >::value
    >::type* /*dummy*/ = nullptr)
    -> typename get_scanline_reader<Device, FormatTag>::type
{
    return make_scanline_reader(io_dev, image_read_settings<FormatTag>());
}
  • Compiler version: msvc 16.9.1
  • Build settings: windows, 64bit
  • boost 1.75

fsmoke avatar Mar 15 '21 14:03 fsmoke