fork download
  1. #include <iosfwd>
  2. #include <boost/iostreams/categories.hpp>
  3. #include <boost/iostreams/positioning.hpp>
  4. #include <boost/iostreams/stream.hpp>
  5.  
  6. class SourceBuffer
  7. {
  8. private:
  9. FILE *file;
  10.  
  11. public:
  12. typedef char char_type;
  13. typedef boost::iostreams::input_seekable category;
  14.  
  15. SourceBuffer(const char *fileName) {}
  16. SourceBuffer() {}
  17. ~SourceBuffer() {}
  18.  
  19. std::streamsize read(char *s, std::streamsize n) {}
  20.  
  21. boost::iostreams::stream_offset seek(boost::iostreams::stream_offset off, std::ios_base::seekdir way) {}
  22.  
  23. void open(const char *fileName) {}
  24. void close() {}
  25. protected:
  26. };
  27.  
  28. int main(void)
  29. {
  30. boost::iostreams::stream<SourceBuffer> *example;
  31. example = new boost::iostreams::stream<SourceBuffer>("test.txt");
  32.  
  33. delete example;
  34. }
  35.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/boost/iostreams/detail/dispatch.hpp:17:0,
                 from /usr/include/boost/iostreams/flush.hpp:17,
                 from /usr/include/boost/iostreams/close.hpp:18,
                 from /usr/include/boost/iostreams/detail/functional.hpp:24,
                 from /usr/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp:24,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:21,
                 from /usr/include/boost/iostreams/stream.hpp:21,
                 from prog.cpp:4:
/usr/include/boost/iostreams/traits.hpp: In instantiation of 'struct boost::iostreams::detail::member_category<mpl_::void_>':
/usr/include/boost/mpl/eval_if.hpp:38:31:   required from 'struct boost::mpl::eval_if<boost::mpl::and_<boost::iostreams::is_std_io<mpl_::void_>, boost::mpl::not_<boost::iostreams::detail::is_boost<mpl_::void_> >, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >, boost::iostreams::select<boost::iostreams::is_filebuf<mpl_::void_>, boost::iostreams::filebuf_tag, boost::iostreams::is_ifstream<mpl_::void_>, boost::iostreams::ifstream_tag, boost::iostreams::is_ofstream<mpl_::void_>, boost::iostreams::ofstream_tag, boost::iostreams::is_fstream<mpl_::void_>, boost::iostreams::fstream_tag, boost::iostreams::is_stringbuf<mpl_::void_>, boost::iostreams::stringbuf_tag, boost::iostreams::is_istringstream<mpl_::void_>, boost::iostreams::istringstream_tag, boost::iostreams::is_ostringstream<mpl_::void_>, boost::iostreams::ostringstream_tag, boost::iostreams::is_stringstream<mpl_::void_>, boost::iostreams::stringstream_tag, boost::iostreams::is_streambuf<mpl_::void_>, boost::iostreams::generic_streambuf_tag, boost::iostreams::is_iostream<mpl_::void_>, boost::iostreams::generic_iostream_tag, boost::iostreams::is_istream<mpl_::void_>, boost::iostreams::generic_istream_tag, boost::iostreams::is_ostream<mpl_::void_>, boost::iostreams::generic_ostream_tag>, boost::iostreams::detail::member_category<mpl_::void_> >'
/usr/include/boost/iostreams/optimal_buffer_size.hpp:47:8:   recursively required from 'struct boost::iostreams::detail::optimal_buffer_size_impl<mpl_::void_>'
/usr/include/boost/iostreams/optimal_buffer_size.hpp:47:8:   required from 'struct boost::iostreams::detail::optimal_buffer_size_impl<SourceBuffer>'
/usr/include/boost/iostreams/optimal_buffer_size.hpp:39:55:   required from 'std::streamsize boost::iostreams::optimal_buffer_size(const T&) [with T = SourceBuffer; std::streamsize = int]'
/usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:163:41:   required from 'void boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::open(const T&, std::streamsize, std::streamsize) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; std::streamsize = int]'
/usr/include/boost/iostreams/stream_buffer.hpp:106:58:   required from 'void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open_impl(const T&, std::streamsize, std::streamsize) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; std::streamsize = int]'
/usr/include/boost/iostreams/stream_buffer.hpp:94:5:   required from 'void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open(const T&, std::streamsize, std::streamsize) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; std::streamsize = int]'
/usr/include/boost/iostreams/stream.hpp:143:9:   required from 'void boost::iostreams::stream<Device, Tr, Alloc>::open_impl(const Device&, std::streamsize, std::streamsize) [with Device = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; std::streamsize = int]'
/usr/include/boost/iostreams/stream.hpp:128:5:   required from 'boost::iostreams::stream<Device, Tr, Alloc>::stream(const U0&, typename boost::disable_if<boost::is_same<U0, T> >::type*) [with U0 = char [9]; Device = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; typename boost::disable_if<boost::is_same<U0, T> >::type = void]'
prog.cpp:31:65:   required from here
/usr/include/boost/iostreams/traits.hpp:242:55: error: no type named 'category' in 'struct mpl_::void_'
 struct member_category { typedef typename T::category type; };
                                                       ^
In file included from /usr/include/boost/iostreams/operations.hpp:20:0,
                 from /usr/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp:29,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:21,
                 from /usr/include/boost/iostreams/stream.hpp:21,
                 from prog.cpp:4:
/usr/include/boost/iostreams/optimal_buffer_size.hpp: In instantiation of 'std::streamsize boost::iostreams::optimal_buffer_size(const T&) [with T = SourceBuffer; std::streamsize = int]':
/usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:163:41:   required from 'void boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::open(const T&, std::streamsize, std::streamsize) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; std::streamsize = int]'
/usr/include/boost/iostreams/stream_buffer.hpp:106:58:   required from 'void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open_impl(const T&, std::streamsize, std::streamsize) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; std::streamsize = int]'
/usr/include/boost/iostreams/stream_buffer.hpp:94:5:   required from 'void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open(const T&, std::streamsize, std::streamsize) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; std::streamsize = int]'
/usr/include/boost/iostreams/stream.hpp:143:9:   required from 'void boost::iostreams::stream<Device, Tr, Alloc>::open_impl(const Device&, std::streamsize, std::streamsize) [with Device = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; std::streamsize = int]'
/usr/include/boost/iostreams/stream.hpp:128:5:   required from 'boost::iostreams::stream<Device, Tr, Alloc>::stream(const U0&, typename boost::disable_if<boost::is_same<U0, T> >::type*) [with U0 = char [9]; Device = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; typename boost::disable_if<boost::is_same<U0, T> >::type = void]'
prog.cpp:31:65:   required from here
/usr/include/boost/iostreams/optimal_buffer_size.hpp:39:55: error: 'optimal_buffer_size' is not a member of 'impl {aka boost::iostreams::detail::optimal_buffer_size_impl<SourceBuffer>}'
     return impl::optimal_buffer_size(detail::unwrap(t));
                                                       ^
In file included from /usr/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp:12:0,
                 from /usr/include/boost/iostreams/close.hpp:19,
                 from /usr/include/boost/iostreams/detail/functional.hpp:24,
                 from /usr/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp:24,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:21,
                 from /usr/include/boost/iostreams/stream.hpp:21,
                 from prog.cpp:4:
/usr/include/boost/iostreams/read.hpp: In instantiation of 'static std::streamsize boost::iostreams::detail::read_filter_impl<boost::iostreams::any_tag>::read(T&, Source&, typename boost::iostreams::char_type_of<T>::type*, std::streamsize) [with T = SourceBuffer; Source = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; std::streamsize = int; typename boost::iostreams::char_type_of<T>::type = char]':
/usr/include/boost/iostreams/read.hpp:57:72:   required from 'std::streamsize boost::iostreams::read(T&, Source&, typename boost::iostreams::char_type_of<T>::type*, std::streamsize) [with T = SourceBuffer; Source = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; std::streamsize = int; typename boost::iostreams::char_type_of<T>::type = char]'
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:256:43:   required from 'static std::streamsize boost::iostreams::detail::flt_wrapper_impl<boost::iostreams::input>::read(Filter&, Source*, typename boost::iostreams::char_type_of<T>::type*, std::streamsize) [with Filter = SourceBuffer; Source = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; std::streamsize = int; typename boost::iostreams::char_type_of<T>::type = char]'
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:78:44:   required from 'std::streamsize boost::iostreams::detail::concept_adapter<T>::read(boost::iostreams::detail::concept_adapter<T>::char_type*, std::streamsize, Source*) [with Source = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; T = SourceBuffer; std::streamsize = int; boost::iostreams::detail::concept_adapter<T>::char_type = char]'
/usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:258:77:   required from 'boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::int_type boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::underflow() [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::int_type = int]'
prog.cpp:34:1:   required from here
/usr/include/boost/iostreams/read.hpp:228:57: error: 'class SourceBuffer' has no member named 'get'
             typename traits_type::int_type c = t.get(src);
                                                         ^
In file included from /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:23:0,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/include/boost/iostreams/stream.hpp:21,
                 from prog.cpp:4:
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp: In instantiation of 'static std::streampos boost::iostreams::detail::flt_wrapper_impl<boost::iostreams::any_tag>::seek(Filter&, Device*, boost::iostreams::stream_offset, std::ios_base::seekdir, std::ios_base::openmode, boost::iostreams::detail::random_access, boost::iostreams::any_tag) [with Filter = SourceBuffer; Device = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; std::streampos = std::fpos<__mbstate_t>; boost::iostreams::stream_offset = long long int; std::ios_base::seekdir = std::_Ios_Seekdir; std::ios_base::openmode = std::_Ios_Openmode]':
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:224:61:   required from 'static std::streampos boost::iostreams::detail::flt_wrapper_impl<boost::iostreams::any_tag>::seek(Filter&, Device*, boost::iostreams::stream_offset, std::ios_base::seekdir, std::ios_base::openmode, boost::iostreams::detail::random_access) [with Filter = SourceBuffer; Device = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; std::streampos = std::fpos<__mbstate_t>; boost::iostreams::stream_offset = long long int; std::ios_base::seekdir = std::_Ios_Seekdir; std::ios_base::openmode = std::_Ios_Openmode]'
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:207:56:   required from 'static std::streampos boost::iostreams::detail::flt_wrapper_impl<boost::iostreams::any_tag>::seek(Filter&, Device*, boost::iostreams::stream_offset, std::ios_base::seekdir, std::ios_base::openmode) [with Filter = SourceBuffer; Device = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; std::streampos = std::fpos<__mbstate_t>; boost::iostreams::stream_offset = long long int; std::ios_base::seekdir = std::_Ios_Seekdir; std::ios_base::openmode = std::_Ios_Openmode]'
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:97:53:   required from 'std::streampos boost::iostreams::detail::concept_adapter<T>::seek(boost::iostreams::stream_offset, std::ios_base::seekdir, std::ios_base::openmode, Device*) [with Device = boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >; T = SourceBuffer; std::streampos = std::fpos<__mbstate_t>; boost::iostreams::stream_offset = long long int; std::ios_base::seekdir = std::_Ios_Seekdir; std::ios_base::openmode = std::_Ios_Openmode]'
/usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:352:68:   required from 'boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::pos_type boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::seek_impl(boost::iostreams::stream_offset, std::ios_base::seekdir, std::ios_base::openmode) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::pos_type = std::fpos<__mbstate_t>; boost::iostreams::stream_offset = long long int; std::ios_base::seekdir = std::_Ios_Seekdir; std::ios_base::openmode = std::_Ios_Openmode]'
/usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:333:35:   required from 'boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::pos_type boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::seekoff(boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::off_type, std::ios_base::seekdir, std::ios_base::openmode) [with T = SourceBuffer; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input_seekable; boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::pos_type = std::fpos<__mbstate_t>; boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::off_type = long long int; std::ios_base::seekdir = std::_Ios_Seekdir; std::ios_base::openmode = std::_Ios_Openmode]'
prog.cpp:34:1:   required from here
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:232:35: error: no matching function for call to 'SourceBuffer::seek(boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >&, boost::iostreams::stream_offset&, std::ios_base::seekdir&)'
     { return f.seek(*dev, off, way); }
                                   ^
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:232:35: note: candidate is:
prog.cpp:21:35: note: boost::iostreams::stream_offset SourceBuffer::seek(boost::iostreams::stream_offset, std::ios_base::seekdir)
   boost::iostreams::stream_offset seek(boost::iostreams::stream_offset off, std::ios_base::seekdir way) {}
                                   ^
prog.cpp:21:35: note:   candidate expects 2 arguments, 3 provided
stdout
Standard output is empty