hello,
I have adjusted the code and it produces the same results.
there is no error message, it just doesn't print what I want...
The key is printed (a string) and then the tabs and "::==" but It will not print the derivation.
the derivation operator << is really very simple.
1 2 3 4
|
std::ostream & operator<<(std::ostream& output, const Derivation& data) {
return output << data.getOString();
}
|
This is the header file for derivation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
class Derivation {
public:
Derivation();
Derivation(const Derivation& orig);
virtual ~Derivation();
friend std::ostream & operator<<(std::ostream&, const Derivation&);
void addElement(std::string x);
void addDerivString(std::string x);
std::string getElementId(int entryNo);
private:
std::string ostring;
const std::string& getOString() const {
return ostring;
}
};
|
As you see << is no more than printing the ostring.
On line 5, of the first post (addProduction), I am able to print d using << , without problems.
When calling print which invokes << from a derivation iterating through the multimap, it doesn't work.
As I can print the derivation correctly before adding inclines me to believe that the problem occurs when adding to or even when invoking the multimap in the first place.
thank you