Re: [Boost-users] Reg : Boost Error - any.hpp
Hi, Below is the snippet code, class Fcif; class FcifNode { public: FcifNode (const string& val): value (val) {}; FcifNode (const Fcif& fcif): value (fcif) {}; FcifNode (const FcifNode& node): value (node.value) {}; FcifNode& operator= (const string& val) { value = val; return *this; }; FcifNode& operator= (const Fcif& val) { value = val; return *this; }; FcifNode& operator= (const FcifNode& val) { value = val.value; return *this; }; bool isValue () const { return (value.type () == typeid (string)); }; bool isFcif () const; type_info const& type () const { return value.type (); }; string& getValue () const; Fcif& getFcif () const; string toString () const; protected: any value; }; class Fcif: public map<string,FcifNode> { public: Fcif () { }; Fcif (const Fcif& fcif): map<string,FcifNode> (fcif) { }; Fcif (const string& fcifString); string getValue (string const& name, bool required = true) const; bool checkValue (string const& name, string& value) const; bool setValue (string const& name, string const& value, bool escapeIt = true); void setValue (Fcif const& fcif); bool removeNode (string const& name, type_info const& type = typeid (void)); bool removeValue (string const& name) { return removeNode (name, typeid (string)); }; bool removeAggregate (string const& name) { return removeNode (name, typeid (Fcif)); }; bool setAggregate (string const& name, Fcif const& fcif); Fcif* getAggregate (string const& name) const { // auto-append '|' to name as needed return const_cast<Fcif*>(this)->addAggregate ( name + ((name.empty () || name[name.size()-1] == '|') ? "" : "|") , false); }; string toString () const; void parseFcif (string const& fcifString); private: Fcif* addAggregate (string const& name, bool create = true); Fcif parsePreFcif (string::const_iterator begin_pos, string::const_iterator& end_pos); string extractTag (string const& name) const { string::size_type tagpos = name.find_last_of ('|'); return name.substr (tagpos == string::npos ? 0 : tagpos + 1); }; string extractAgg (string const& name) const { string::size_type tagpos = name.find_last_of ('|'); return name.substr (0, tagpos == string::npos ? 0 : tagpos); }; }; Regards, Vijay Can you please post at least a self-consisting code snippet which allows to reproduce it... Otherwise I doubt someone will help you with this... Best Regards, Ovanes On Sun, Aug 28, 2011 at 7:57 AM, Vijay <v2k.sweet_at_[hidden]> wrote:
Hi,
We are using boost version 1.31.0 in our C++ code. Our OS is HP-UX 11.31 Itanium. We use aCC compiler. While compiling my code, I'm getting the
below
error. Can any one help me to fix this issue ?
"/opt/app/q1app2c4/boost-1.31.0/boost/any.hpp", line 125: error #2070: incomplete type is not allowed ValueType held; ^ detected during: instantiation of class "boost::any::holder<ValueType> [with ValueType=Fcif]" at line 32 instantiation of "boost::any::any(const ValueType &) [with ValueType=Fcif]" at line 35 of "/opt/app/q1app2c4/src/share/incl/Fcif.h"
Cheers, Vijay....(V2K) E-mail to : v2k.sweet_at_[hidden] Catch me @ 9962003328, 7871181610 Blackberry PIN : 259943F3 "Life is just one grand sweet song, so start the music."
On Aug 30, 2011, at 10:37 PM, Vijay <v2k.sweet@gmail.com> wrote:
class Fcif;
As someone already pointed out, it's because you're trying to initialize the any with an incomplete type, ie one that has been declared but not defined. Try defining Fcif, or moving the failing constructor to the cpp, and including the definition of Fcif there.
participants (2)
-
Gordon Woodhull
-
Vijay