Re: How to read a 8-bit grayscale JPEG image using C++?
On Jul 20, 3:16 am, "BobR" <removeBadB...@worldnet.att.net> wrote:
Kai-Uwe Bux <jkherci...@gmx.net> wrote in message...
[...]
buffer the_buf ( std::istreambuf_iterator<char>( infile ),
(std::istreambuf_iterator<char>() ) );
^^^ ^^^
What you wrote is parsed as a function declaration.
Not after the correct *_iterator got 'called' with '.rdbuf()'.
Not a question of the "correct" iterator: istreambuf_iterator
has a constructor which takes an istream, as well as one which
takes a streambuf. The problem is that:
std::istreambuf_iterator< char >( infile )
can be interpreted as a declaration, and when something can be
interpreted as a declaration, it is. And if what looks like
arguments to us are in fact declarations, then the above
declares a function. Putting in the extra pair of parentheses
creates a context where a declaration (of a function parameter)
is not legal, so it isn't interpreted as a declaration, but as
an expression to be passed to the constructor, and we have a
data definition, rather than a function declaration.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34