Am 07.12.2012 09:53, schrieb Jean-Michel Caricand:

Hello,

std::string v;
tnt::TntConfig::it().config.getMember<std::string>("myvariable", v);
log_info(v);

That works :) !

Jean-Michel

Better is to use deserialization operator from the serialization framework like that:

   tnt::TntCofig::it().config.getMember("myvariable") >>= v;

or

   tnt::TntCofig::it().config.getMember("myvariable", v);

Your variant won't work in the future. The template method you used is removed in cxxtools already in the svn version.

The difference between the 2 variants is, that in the first "myvariable" is mandatory and you will get a exception, if it is not set. The second variant modifies the second variable, which is passed as a non const reference and returns a bool weather v is really set.

Using it, you are not limited to some scalars but can read any value, which has a deserialization operator >>= defined.

Tommi
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to