Egor Kraev's Homepage
  Modifying the source code to work with Visual C++ 2003
Book Home
Code
VC++ 2003
Typos
FAQ
 
 

Since Visual C++ 2003, Microsoft made the C++ compiler more ANSI/ISO compliant, in particular regarding the use of typedef in templates. Since most of the code on the CD was tested under VC++ 6.0, some files need to be adjusted to work under VC++ 2003, or for that matter other standard-compliant compilers such as Dev-C++.

The files affected are at least SimplePropertySet.cpp and FunctionSet.*pp - the links lead to corrected versions. Please tell me if the issue arises in other files.

The issue is the following: we declare the following typedefs in SimplePropertySet.hpp:

      typedef typename list<Property<N,V> >::iterator iterator;
      typedef typename list<Property<N,V> >::const_iterator const_iterator;

In older versions of VC++ when you use a typedef type you could just use their name (here iterator and const_iterator). But in VC++ 2003 we must refer these names with the keyword "typename". So everywhere you say "iterator" you should now say "typename iterator". So

// Iterator functions

template <class N, class V>
SimplePropertySet<N,V>::iterator SimplePropertySet<N,V>::Begin()
{ // Return iterator at begin of composite
      return sl.begin();
}


Becomes:

// Iterator functions

template <class N, class V>
typename SimplePropertySet<N,V>::iterator SimplePropertySet<N,V>::Begin()
{ // Return iterator at begin of composite
      return sl.begin();
}