Boost logo

Boost Users :

From: Cromwell Enage (sponage_at_[hidden])
Date: 2007-03-17 23:43:02


--- Santosh Joseph wrote:
> My code compiles on visual studio 8, but on g++
> 3.3.2 (linux) and with g++ 3.4.4 (cygwin) it chokes
> with the following error:
>
> In function
> `void convertToScctsOpt()':
> optionmanager.cpp:119: error: expected
> init-declarator
> before "ScctsType"
> optionmanager.cpp:119: error: expected `, ' or `;'
> before "ScctsType"
> optionmanager.cpp:120: error: `ScctsType' undeclared
> (first use this function)
>
>
> Is some special command line argument needed?

No.

> #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
> #define BOOST_MPL_LIMIT_MAP_SIZE 50
> #include <boost/mpl/map.hpp>
> #include <boost/mpl/at.hpp>
> #include <boost/mpl/pair.hpp>
> namespace bm = boost::mpl;
>
> typedef bm::map<
> bm::pair<Type1, MappedType1>,
> .
> .
> .
> bm::pair<Type41, MappedType41>
> > TypeToTypeMap;
>
>
> template<typename SoapType>
> inline void convertToScctsOpt()
> {
> typedef bm::at<TypeToTypeMap,SoapType>::type
> ScctsType;
>
> }

This last function needs to be:

template<typename SoapType>
inline void convertToScctsOpt()
{
    typedef typename
bm::at<TypeToTypeMap,SoapType>::type ScctsType;
}

The "typename" keyword is required here by the C++
standard to indicate that ::type is a nested type.

                              HTH,
                              Cromwell D. Enage

 
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net