Thread: boost iostreams

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    630

    boost iostreams

    Hello

    Is there any way to reuse filtering_istream object after it has been used..

    For instance:

    Code:
    boost::iostreams::filtering_istream   filter_stream;
    boost::iostreams::file_source 	file_source("somefile");
    some_filter 				some_filter_object;
    
    filter_stream.push(boost::ref(some_filter_object));
    filter_stream.push(boost::ref(file_source));
    
    
    //do read and some stuff
    //..
    
    boost::iostreams::file_source 		file_source2("somefile2");
    
    filter_stream.empty();
    
    filter_stream.push(boost::ref(some_filter_object));
    filter_stream.push(boost::ref(file_source2));
    
    //read somefile2
    Is this possible? The code above doesnt work..

    I want just want to reuse filter_stream (filtering_istream) object so that I could read data from another file..

    Thanks a lot for help

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I never used this one. However a quick check over the library documentation revealed:

    filtering_istream.reset() as a likely candidate and filter_stream.empty() not being what you think, but instead a member function that returns true if the filtering chain is empty.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    630
    Thanks Mario! .reset() does what I need!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. boost iostreams is_open()
    By l2u in forum C++ Programming
    Replies: 0
    Last Post: 02-21-2008, 10:00 AM
  2. Boost Auto-Linking
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 12-30-2007, 06:11 AM
  3. boost iostreams and compression
    By l2u in forum C++ Programming
    Replies: 2
    Last Post: 05-04-2007, 06:11 AM
  4. building boost iostreams
    By l2u in forum C++ Programming
    Replies: 3
    Last Post: 04-14-2007, 02:29 PM
  5. Integrating Boost with STLPort
    By Mario F. in forum Tech Board
    Replies: 1
    Last Post: 11-11-2006, 06:49 AM