[odb-users] Custom pointer as in pointer-traits.hxx

Andreas Pasternak MT-Robot AG a.pasternak at mt-robot.com
Wed Sep 16 05:15:22 EDT 2015


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


More information about the odb-users mailing list