Hello Benedikt,

Passing an object as a parameter or return value of a function makes a copy
of that object. The soci::session is non-copyable, ie, the copy constructor
is made private to prevent the users from doing that. You can pass around a
pointer or a reference to it though.

Not sure about the reasoning behind this decision, cc-ing soci-users maybe
someone from that list can shed some light on it.

Cheers,

Aleksander


On Thu, Mar 20, 2014 at 12:57 AM, Benedikt Greipl <[email protected]> wrote:

> Hello Pawel,
>
> I have come across an error in the soci framework that seems strange to
> me and wanted to ask you what you think.
>
> It seems I cannot handle an object ' soci::session sql ' like any other
> - that is I can't use it as a function's return value, or as a parameter
> of a function. The compiler tells me because it's defined as a private
> object in session.h in the soci library. Simply changing it to public
> makes the linking break down at compilation.
>
> Can you please give me some advice of how to fix this? Thank you very much!
>
> Cheers,
>
> Ben
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to