[odb-users] Custom pointer as in pointer-traits.hxx
Andreas Pasternak MT-Robot AG
a.pasternak at mt-robot.com
Wed Sep 16 10:57:50 EDT 2015
Ok, I figured it out. I tried to create a pointer of a db value (an
int exactly) and not an db object.
Now everything works without any problems.
----------------original message-----------------
From: Andreas Pasternak MT-Robot AG [a.pasternak at mt-robot.com ]
To: odb-users at codesynthesis.com Date: Wed, 16 Sep 2015 11:15:22 +0200
-------------------------------------------------
> Hello all,
>
> A third party framework uses a custom pointer. So I tried to create
> a simple example:
>
> template
> class mypointer {
> public:
> T* ptr;
> };
>
> I tried then according to the manual but also as a hack directly in
> pointer-traits.hxx to insert:
>
> namespace odb
> {
> template
> class pointer_traits >
> {
> public:
> static const pointer_kind kind = pk_unique;
> static const bool lazy = false;
>
> typedef T element_type;
> typedef mypointer pointer_type;
> typedef mypointer const_pointer_type;
> typedef smart_ptr_guard
> guard;
> };
> } //end odb
>
> I then get the error message:
>
> error: unable to map C++ type '::mypointer' used in data member
> 'myptr' to a MySQL database type
>
> Other pointers (std::shared_ptr etc.) work. I also tried to
> copy&past the std::shared_ptr code and adapt it, leaving it as close
> to the original as possible. I just have no clue why it does not
> find my template spezialisation.
>
> But it does compile it, if I have an error in the code it complains.
> Also my container specialisation and string specialisation I made
> work flawlessly. I just don't get the pointers to work.
>
> Thank you,
>
> Andreas
>
--
MT Robot AG
Riedstrasse 16
CH-4222 Zwingen
Tel. - +41 (0)61 775 20 20
Direkt - +41 (0)61 775 20 26
Mobile - +41 (0)76 489 21 16
Fax - +41 (0)61 775 20 21
Email - [ mailto:a.pasternak at mt-robot.com %20%20 ->
a.pasternak at mt-robot.com ]
Web - www.mt-robot.com
Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte
Informationen enthalten.Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort
den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren
sowie die unbefugte Weitergabe dieser E-Mail sind nicht gestattet.
This e-mail may contain confidential and/or privileged information. If
you are not the intended recipien
More information about the odb-users
mailing list