
On 06/12/10 17:28, Kenny Riddile wrote:
On 12/6/2010 11:26 AM, Mateusz Loskot wrote:
On 06/12/10 16:21, Kenny Riddile wrote:
On 12/6/2010 10:10 AM, Christian Henning wrote:
I accomplish this using Boost.IOStreams...something like this works for me:
using namespace boost::iostreams; stream< array_source> bufferStream( buffer, size ); read_image( bufferStream, dest, jpeg_tag() );
Cool this is what I was looking for. No extra copying involved?
From the IOStreams documentation on array_source:
"Model of Source providing read-only access to a sequence of characters in memory."
doesn't sound like any copying to me :)
I'm afraid this is your interpretation. This statement does not say anything about copying. It only states read-only access is performed. It is possible read-only access is performed against a copy of data.
I agree that it's just my interpretation and I haven't verified that interpretation. Still I think it is likely to be a common interpretation, and one that is only incorrect if the author of the documentation was intentionally trying to be confusing and/or the library author was doing something silly.
I am not sure about it. IMO, the situation is is similar to standard algorithms and predicates: if a semantic is not specified in details, any valid semantic is possible in terms of presented function prototype/class definition, etc. Reading about std::remove_if in copy of the n3092, I don't see a word about specific move/copy requirements of predicate, however, the algorithm is free to make number of copies of the predicate internally. Back to the Boost.IOStreams, indeed, the docs are incomplete [1] but as the the author explained on the list, the devices (Source is a device) does not have to follow "must be copy-constructibile" but they "can be non-copyable", what means that some may be copyable as well. [1] http://lists.boost.org/Archives/boost/2005/11/96479.php [2] http://lists.boost.org/Archives/boost/2005/10/95939.php Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org Member of ACCU, http://accu.org