[odb-users] Can I use C++ 17 std::optional members with ODB?

Mann, David W (B62) CTR USN NAVSURFWARCEN DAH VA (USA) david.w.mann5.ctr at us.navy.mil
Wed Jun 15 13:31:32 EDT 2022


Hello,

 

I just tried to add some optional values to an ODB class.  This class works
with C++17 primitive types (std::string, int, double).  However, when I
added the following members, I get an error during the ODB compile:

 

std::optional<double> m_testDouble;

 

The error was error: unable to map C++ type '::std::optional< double >' used
in data member 'm_testDouble' to a SQLite database type.

 

Is there a way I can work around this?  I also tried to make the declaration
a type and use #pragma db value, but I got a different error about the type
not being persistent.

 

V/R

 

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6698 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20220615/b9246705/smime.bin


More information about the odb-users mailing list