Re: [Cppcms-users] cppcms::json::value desing question
Brought to you by:
artyom-beilis
From: Daniel V. <chi...@gm...> - 2010-03-16 07:03:50
|
On Mon, 2010-03-15 at 22:45 -0700, Artyom wrote: > > 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. As a comment I think no virtual destructor is OK in this case because the derivation has no useful polymorphic usage. But you are right. > 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? As you can see I made a mistake, unorderer_map has constant mean 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). Very good rationale point. You convinced me in all points. > Artyom > > Please, register to mailing list so I would not have to moderate > incoming messages. > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |