Am 27.04.2013 14:05, schrieb Jean-Michel Caricand:
> Le 27/04/2013 10:53, Tommi Mäkitalo a écrit :
>
...
OK - hats another case. In that case it is OK to use SerializationInfo. 
As far as I understand, your code works as you expect. So I can just 
give you some hints how to ease the use of SerializationInfo.

There are some convenience stuff, you may want to use.
si.getMember(std::string) returns the member or if the member does not 
exists, it throws an exception.

The template member:
template <typename T> bool SerializationInfo::getMember(std::string, T& v)

is a helper, which fills the passed reference if the member is found and 
returns true. If the member does not exist, false is returned. So 
instead of using findMember, you can write:

      cxxtools::SerializationInfo si_b;
      if (si.getMember("b", si_b))
      {
...

If you just want to check, if a member exists like you do with "e", you 
can write:

      if (si.findMember("e"))

Which again saves some code.

Tommi

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to