[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-plusplus
Subject:    Re: Differences between query constructors
From:       "Jonathan Wakely" <mysql () kayari ! org>
Date:       2007-04-20 16:15:55
Message-ID: 4d11fcd70704200915m76f697a9ja579da586e83a5f2 () mail ! gmail ! com
[Download RAW message or body]

On 20/04/07, Warren Young <mysqlpp@etr-usa.com> wrote:
> But seriously, I really don't think we want to do that.  Query isn't
> simple enough that I trust a C++ bitwise copy to do the right thing.
> You need a real copy ctor to avoid disaster.

(N.B. An implicitly-defined copy ctor isn't a bitwise copy except for POD types)

> I'd argue that Queries shouldn't be copied at all, but the response to
> that is to make the copy ctor private, not get rid of it entirely.

Actually, if you remove your user-defined copy ctor then the implicit
one will try to copy the std::ostream base and the std::stringbuf
member, both of which are non-copyable. So in this case simply
removing it would be even better than doing the private-and-undefined
trick, since you'd be guaranteed a compile-time failure if you try to
copy a Query.

With the private-and-undefined trick the Query class itself and its
friend SQLQueryParams could accidentally create copies, which wouldn't
be caught until link time.

Jon

-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql-plusplus@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic