Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-01-14 09:28:54


Hi,

I have sent a problem report on the list, recently, regarding mpl::find_if algorithm on
vc7 platform. I'm using 1.29 release not current cvs snapshot.

I assume, that description was not good enough so I haven't got any response.

Problem:
        mpl::find_if algorithm does not compile with vc7. Simple inclusion of the boost/mpl/find_if.hpp
header generates a compiler error. Error occurs also on libs/mpl/test/find_if.cpp

Error message is following:

find_if.cpp
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(26) : error C2143: syntax error : missing ';' before '<'
        D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(25) : see reference to class template instantiation 'boost::mpl::aux::iter_fold_if_step_impl<>::result_<<template parameter>,<template parameter>,<template parameter>,<template parameter>>' being compiled
        D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(29) : see reference to class template instantiation 'boost::mpl::aux::iter_fold_if_step_impl<>' being compiled
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(26) : error C2039: 'type' : is not a member of 'operator``global namespace'''
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(26) : error C2238: unexpected token(s) preceding ';'
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(55) : error C2143: syntax error : missing ';' before '<'
        D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(62) : see reference to class template instantiation 'boost::mpl::aux::iter_fold_if_forward_step<Iterator,State,ForwardOp,Predicate>' being compiled
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(55) : error C2039: 'type' : is not a member of 'operator``global namespace'''
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(55) : error C2238: unexpected token(s) preceding ';'
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(57) : error C2653: 'not_last' : is not a class or namespace name
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(58) : error C2065: 'value' : undeclared identifier
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(72) : error C2143: syntax error : missing ';' before '<'
        D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(79) : see reference to class template instantiation 'boost::mpl::aux::iter_fold_if_backward_step<Iterator,State,BackwardOp,Predicate>' being compiled
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(72) : error C2039: 'type' : is not a member of 'operator``global namespace'''
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(72) : error C2238: unexpected token(s) preceding ';'
D:/Boost\boost\mpl\aux_\preprocessed\msvc70\iter_fold_if_impl.hpp(74) : error C2653: 'not_last' : is not a class or namespace name

I have found a simple fix for a problem. In file boost/mpl/find_if.hpp, the order of inclusions have to be changed.

Original:
--------------------------------------------------
#ifndef BOOST_MPL_FIND_IF_HPP_INCLUDED
#define BOOST_MPL_FIND_IF_HPP_INCLUDED

#include "boost/mpl/aux_/iter_fold_if_impl.hpp"
#include "boost/mpl/aux_/iter_apply.hpp"
#include "boost/mpl/logical/or.hpp"
#include "boost/mpl/logical/not.hpp"
#include "boost/mpl/begin_end.hpp"
#include "boost/mpl/always.hpp"
#include "boost/mpl/lambda.hpp"
--------------------------------------------------

Patched:
--------------------------------------------------
#ifndef BOOST_MPL_FIND_IF_HPP_INCLUDED
#define BOOST_MPL_FIND_IF_HPP_INCLUDED

#include "boost/mpl/aux_/iter_apply.hpp"
#include "boost/mpl/aux_/iter_fold_if_impl.hpp"
#include "boost/mpl/logical/or.hpp"
#include "boost/mpl/logical/not.hpp"
#include "boost/mpl/begin_end.hpp"
#include "boost/mpl/always.hpp"
#include "boost/mpl/lambda.hpp"
#include "boost/mpl/bind.hpp"
-------------------------------------------------

If the order of first two includes is reversed, the error is resolved.

I don't have a deep understandness of mpl implementation so it is possible that this patch breaks something else.
It is also possible, that the problem is already fixed in cvs.

Please, let me know what is the status of this.

Thanks,

Pavol


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk