Re: Handling utf8 data from SQLite

On Mon, 12 Sep 2011 00:34:11 +0100
Chris Vine <chris cvine freeserve co uk> wrote:
> Has this changed in C++11?  If so, what additional excptions will a
> const type in the catch statement cover which a non-const type will
> not, under the new standard?  (I have a copy of the draft standard so
> if you can point me to the paragraph concerned that would be very
> helpful
> - it is always nice to learn new things.)

If it helps, I see that §15.1 of the C++11 standard says:

"A throw-expression initializes a temporary object, called the
exception object, the type of which is determined by removing any
top-level cv-qualifiers from the static type of the operand of throw
and adjusting the type from “array of T” or “function returning T” to
“pointer to T” or “pointer to function returning T”, respectively. The
temporary is an lvalue and is used to initialize the variable named in
the matching handler (15.3)."

This seems to me to be identical in effect to C++98 - a temporary
copy with all cv qualifiers removed (ie non-const) is created, which
although a temporary is treated as an lvalue (normally temporaries are
rvalues) which will therefore bind to a non-const reference.  As it
happens, section 15.3 goes on to prohibit explicitly rvalue
references types in the catch specification, which is redundant as a
necessary corollary of the exception copy comprising a lvalue is that it
won't bind to rvalue references.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]