Boost logo

Boost Users :

Subject: Re: [Boost-users] Property tree custom_data_type.cpp fails to compile in boost 1.42.
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2010-02-17 11:54:31


Mauricio Gomes wrote:
> The example
> C:\boost_1_42_0\libs\property_tree\examples\custom_data_type.cpp fails
> to compile for me.
> I am using Code::Blocks 8.02 with mingw gcc 4.4.0.
>
> I am getting the following error message:
>
> ||=== test, Debug ===|
> C:\projects\test\main2.cpp||In function 'int main()':|
> C:\projects\test\main2.cpp|59|error: wrong number of template
> arguments (5, should be 3)|
> C:\boost_1_42_0\boost\property_tree\ptree_fwd.hpp|29|error: provided
> for 'template<class Key, class Data, class KeyCompare> class
> boost::property_tree::basic_ptree'|
> C:\projects\test\main2.cpp|59|error: invalid type in declaration
> before ';' token|
> C:\projects\test\main2.cpp|63|error: request for member 'put' in 'pt',
> which is of non-class type 'my_ptree'|
> C:\projects\test\main2.cpp|64|error: request for member 'get' in 'pt',
> which is of non-class type 'my_ptree'|
> C:\projects\test\main2.cpp|64|error: expected primary-expression
> before 'int'|
> C:\projects\test\main2.cpp|64|error: expected ',' or ';' before 'int'|
> C:\projects\test\main2.cpp|68|error: request for member 'put' in 'pt',
> which is of non-class type 'my_ptree'|
> C:\projects\test\main2.cpp|68|error: expected primary-expression
> before '>' token|
> C:\projects\test\main2.cpp|68|warning: left-hand operand of comma has
> no effect|
> C:\projects\test\main2.cpp|69|error: request for member 'get' in 'pt',
> which is of non-class type 'my_ptree'|
> C:\projects\test\main2.cpp|69|error: expected primary-expression
> before '>' token|
> C:\projects\test\main2.cpp|74|error: request for member 'put' in 'pt',
> which is of non-class type 'my_ptree'|
> C:\projects\test\main2.cpp|74|error: expected primary-expression
> before '>' token|
> C:\projects\test\main2.cpp|74|warning: left-hand operand of comma has
> no effect|
> C:\projects\test\main2.cpp|75|error: request for member 'get' in 'pt',
> which is of non-class type 'my_ptree'|
> C:\projects\test\main2.cpp|75|error: expected primary-expression
> before '>' token|
> ||=== Build finished: 15 errors, 2 warnings ===|
>
>
> The problem seems to be the number of template parameters in line 59:
> // Property_tree with boost::any as data type
> // Key comparison: std::less<std::string>
> // Key type: std::string
> // Path type: path
> // Data type: boost::any
> // Translator type: my_translator
> typedef basic_ptree<std::less<std::string>, std::string, path,
> boost::any, my_translator> my_ptree;
> my_ptree pt;
>
>
> Am I missing something ?
Not all the examples have been updated after I changed a lot of details
about the PTree implementation, so they don't all compile.

Sebastian


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