Home c++ C3646 error: unknown redefidation specifier

C3646 error: unknown redefidation specifier

Author

Date

Category

I study C++ on the book, at the end of the chapter there are tasks and one of them – make the character counting function in the Document class. When creating a class, a problem occurred: when the program starts, the error “C3646 Begin: Unknown definition specifier” appears. The same error with the End () function;

document.h:

# include & lt; list & gt;
#Include & lt; vector & gt;
#Include & lt; iostream & gt;
Using Namespace STD;
using line = vector & lt; char & gt ;;
Struct Document {
  List & lt; line & gt; Line;
  Document () {line.push_back (Line {}); }
  Text_iterator begin () {return text_iterator (line.begin (), line.begin () - & gt; begin ()); } // here error
  Text_iterator end () {Return Text_Iterator (Line.end (), line.end () - & gt; end ()); } // in this line as well
  INT COUNT ();
};
Istream & amp; Operator & gt; & gt; (Istream & amp; IS, Document & amp; d) {
  For (char ch; is.get (CH);) {
    D.Line.Back (). Push_back (CH);
    if (ch == '\ n') d.line.push_back (Line {});
  }
  if (d.line.back (). size ()) D.Line.Push_back (Line {});
  Return is;
}
Class Text_iterator {
  List & lt; Line & gt; :: iterator ln;
  Line :: ITERATOR POS;
Public:
  Text_iterator (LIST & LT; LINE & GT; :: ITERATOR LL, LINE :: ITERATOR PP): LN {LL}, POS {pp} {}
  Char & amp; operator * () {Return * POS; }
  Text_terator & amp; Operator ++ ();
  BOOL OPERATOR == (Const Text_Iterator & Amp; Other) Const {Return LN == Other.ln & amp; & amp; pos == other.pos; }
  ! Bool operator = (const Text_iterator & amp; other) const {return (* this == other)!; }
};

Answer 1, Authority 100%

Well, how does the compiler know what the Text_iterator before of its announcement?

Drag the class declaration Text_iterator to the class Document .

The answer is only to your specific question; true if all of you will be after this work – have not tested …

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions