1

I have the following code:

namespace boost {
    namespace property_tree {
        template<class Key, class Data, class KeyCompare>
        class basic_ptree;

        typedef basic_ptree<std::string, std::string, std::less<std::string> > ptree;
    }
}

class JsonReader {

public:
    JsonReader();

    ~JsonReader() { };

    void processValuation(std::vector<Simulation> &simulations);

private:

    std::string processOptionParams(const ptree::value_type &node);

    void loadConfig(std::string filename);

    std::shared_ptr<boost::property_tree::ptree> jsonTree_;
};

Everything is fine, but I'm not sure how to forward declare ptree::value_type. Any ideas how can it be done?

The file with value_type definition you can find here http://www.boost.org/doc/libs/1_60_0/boost/property_tree/ptree.hpp

JosephConrad
  • 678
  • 2
  • 9
  • 20

1 Answers1

2

You can't forward declare a type member off of a forward declared type. That leaves you with either just pulling out the actual definition of value_type from ptree (not recommended), or simply including the full header ptree.hpp.

Once you need the internals of a class in your header file, forward-declaration isn't an option.

Barry
  • 286,269
  • 29
  • 621
  • 977
  • ok, thanks, I realise that we cant forward declare 'normal' member of the class, but I thought that maybe it is different with typedef. Anyway, thanks a lot! – JosephConrad Mar 05 '16 at 16:06