Re: [Cppcms-users] cppcms::json::value desing question
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-03-16 05:45:30
|
> Hello Artyom > >I think that boost::variant type fits exactly as base class for > cppcms::json::value. > > I think that one pro of this approach is that boost::variant interface > is more familiar and has good visitor interface. > > You think about that? > > This break your ABI requirerements? Exactly. See http://cppcms.sourceforge.net/wikipp/en/page/cppcms_1x_coding_standards#abi_boost I can't use Boost libraries in CppCMS interfaces for very simple reason: they ABI can be easily broken even with simple define addition in headers. For example boost::shared_ptr changes its strucutres layout with special define. So I can't use Boost in iterfaces. 2nd issue is that AFAIK boost::variant does not have virtual descructor so deriving from it is bad idea. However I use exactly boost::variant in implementation of cppcms::json. > Another question. You define json::object as std::map, which it has > O(log n) complexity for access > > Why you not use boost::unordered_map which it has O(n) complexity? Same reason as above, untill std::unordered_map would be availible in major compilers I would use std::map. Also, please note, that for relatively small maps, std::map would be even faster (and this is the case in most json objects). Artyom Please, register to mailing list so I would not have to moderate incoming messages. |