Boost logo

Boost Users :

From: Andrea Carbone (andrea.carbone_at_[hidden])
Date: 2006-11-02 11:24:01


No idea yet?
:)

anyway ... if you want to take a look at the sources...

http://www.dis.uniroma1.it/~carbone/property_tree/

Maybe I do something wrong and I have not well interpreted
how to write a template method of a non template class ..

But the result is so strange.... 24 MB for a lib is too much.

Regards,
Andrea

Andrea Carbone wrote:
> Hello,
>
> I am working on a little class using the property_tree lib.
> MSVC 7.1, boost 1.33.1 and latest property_tree cvs from sandbox.
>
> I have simply Pimpled the boost::property_tree::ptree class and
> implemented a templated get<> to extract values from a conf file ...
>
> I don't know if it is fair to attach files to the mail so I just paste
> the header...
>
> Here the interface:
>
> #ifndef xml_config_t_H_INCLUDED
> #define xml_config_t_H_INCLUDED
> //---------------------------------------------------------------------
> #include <string>
> #include <memory>
> //---------------------------------------------------------------------
> //just tags ...
> namespace all { namespace core{
>
> namespace detail
> {
> struct xml_t{};
> struct ini_t{};
> }
> static const core::detail::xml_t xml = core::detail::xml_t();
> static const core::detail::ini_t ini = core::detail::ini_t();
> }}
> //---------------------------------------------------------------------
> namespace all { namespace core{
> //the implementation
> namespace detail{class xml_config_impl;}
> class xml_config_t;
>
> }}
> //---------------------------------------------------------------------
> class all::core::xml_config_t
> {
> public:
> ///Constructor
> xml_config_t();
> ~xml_config_t();
>
> ///this one calls read_xml
> void load(core::detail::xml_t, const std::string&);
> ///this one calls read_ini
> void load(core::detail::ini_t, const std::string&);
>
> public:
> ///the template get method .. calls ptree::get<T> ....
> template <typename T>
> T get(const std::string&, const T& defval = T()) const;
>
> private:
> //pimpl idiom
> std::auto_ptr<core::detail::xml_config_impl> impl;
> };
> //---------------------------------------------------------------------------
> #endif //xml_config_t_H_INCLUDED
> //---------------------------------------------------------------------------
>
>
> The code compiles and it actually works ... that is fine.
>
> But the problem is that Compiling the class as a static lib, produces an
> huge library (~14 MB !!).
>
> I am compiling wiht /MT flag .. RTTI is off and there are just default
> settings ...
>
> Why such a huge library file?
>
> The templated method is defined for some builtin data types such as int,
> float, long ...etc ...
>
>
> Thanks for your attention ....


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net