Hi

how exactly should the boost::optional trait  be used with dbo? I try  
to make a member like

  boost::optional<Wt::WString>    briefSrc;


and map with

template<class Action>
   void persist(Action& a)
   {
     dbo::field(a, state,     "state");
     dbo::field(a, date,      "date");
     dbo::field(a, title,     "title");
     dbo::field(a, briefSrc,  "brief_src");
     dbo::field(a, briefHtml, "brief_html");
     dbo::field(a, bodySrc,   "body_src");
     dbo::field(a, bodyHtml,  "body_html");
}
Then I get errors like these

/opt/packages/wt/src/Wt/Dbo/Field_impl.h: In member function  
'std::string Wt::Dbo::FieldRef<V>::sqlType(Wt::Dbo::Session&) const  
[with V = boost::optional<Wt::WString>]':
/opt/packages/wt/src/Wt/Dbo/DbAction_impl.h:97:   instantiated from  
'void Wt::Dbo::CreateSchema::act(const Wt::Dbo::FieldRef<V>&) [with V  
= boost::optional<Wt::WString>]'
/opt/packages/wt/src/Wt/Dbo/Field_impl.h:134:   instantiated from  
'void Wt::Dbo::field(Action&, V&, const std::string&, int) [with  
Action = Wt::Dbo::CreateSchema, V = boost::optional<Wt::WString>]'
/opt/packages/wt/examples/dbo/Post.h:58:   instantiated from 'void  
Post::persist(Action&) [with Action = Wt::Dbo::CreateSchema]'
/opt/packages/wt/src/Wt/Dbo/DbAction_impl.h:19:   instantiated from  
'static void Wt::Dbo::persist<C, Enable>::apply(C&, A&) [with A =  
Wt::Dbo::CreateSchema, C = Post, Enable = void]'
/opt/packages/wt/src/Wt/Dbo/DbAction_impl.h:82:   instantiated from  
'void Wt::Dbo::CreateSchema::visit(C&) [with C = Post]'
/opt/packages/wt/src/Wt/Dbo/Session_impl.h:234:   instantiated from  
'void  
Wt::Dbo::Session::ClassMapping<C>::createTable(Wt::Dbo::Session&,  
std::set<std::basic_string<char, std::char_traits<char>,  
std::allocator<char> >, std::less<std::basic_string<char,  
std::char_traits<char>, std::allocator<char> > >,  
std::allocator<std::basic_string<char, std::char_traits<char>,  
std::allocator<char> > > >&) [with C = Post]'
/opt/packages/wt/examples/dbo/Post.C:16:   instantiated from here
/opt/packages/wt/src/Wt/Dbo/Field_impl.h:41: error: no matching  
function for call to  
'Wt::Dbo::sql_value_traits<boost::optional<Wt::WString>,  
void>::type(Wt::Dbo::SqlConnection*, const int&)'
/opt/packages/wt/src/Wt/Dbo/StdSqlTraits:116: note: candidates are:  
static std::string Wt::Dbo::sql_value_traits<boost::optional<T>,  
void>::type(Wt::Dbo::SqlConnection*) [with T = Wt::WString]

given that the candidate suggested by the compiler appears to be  the  
correct one, I am wondering if there is a compiler bug.... I am using  
the standard 4.2 g++ ((Apple Inc. build 5577)) under OS X 10.5.8 or is  
there some other trick to getting the template instantiation to happen  
when using boost::optional?

Regards,
        Paul.


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to