Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-03-06 13:46:21


Hello All,

using boost::wave (with context initialized as explained in the docs example) and trying to find
out if some certain macro is defined leads to 2 errors:
1. Doc for context state:
bool is_defined_macro(std::string const &name) const;

But the source has no such function definition. I assume the signature was changed to:
template <typename IteratorT2>
bool is_defined_macro(IteratorT2 const &begin, IteratorT2 const &end)
{ return macros.is_defined(begin, end); }

Trying to fix it and using the std::string::begin() and std::string::end() members to specify the
begin and end range result in the error:

c:\boost\include\boost-1_33_1\boost\wave\util\cpp_macromap.hpp(331) : error C2228: left of
'.get_value' must have class/struct/union
        type is 'char'
        c:\boost\include\boost-1_33_1\boost\wave\cpp_context.hpp(150) : see reference to function
template instantiation 'bool
boost::wave::util::macromap<ContextT>::is_defined<IteratorT2>(const IteratorT &,const
IteratorT &)' being compiled
        with
        [
            ContextT=boost::wave::context<token_groups::str_iter_type,token_groups::lex_iter_type>,
            IteratorT2=char *,
            IteratorT=char *
        ]
        e:\projects\inpecting_wave\inpecting_wave\header_processor.cpp(177) : see reference to
function template instantiation 'bool
boost::wave::context<IteratorT,LexIteratorT>::is_defined_macro<char*>(const IteratorT2
&,const IteratorT2 &)' being compiled
        with
        [
            IteratorT=token_groups::str_iter_type,
            LexIteratorT=token_groups::lex_iter_type,
            IteratorT2=char *
        ]

This happens in cpp_macromap.hpp line 331:

function source:
template <typename ContextT>
template <typename IteratorT>
inline bool
macromap<ContextT>::is_defined(IteratorT const &begin,
    IteratorT const &end)
{
// in normal mode the name under inspection should consist of an identifier
// only
token_id id = token_id(*begin);

    if (T_IDENTIFIER != id &&
        !IS_CATEGORY(id, KeywordTokenType) &&
        !IS_EXTCATEGORY(id, OperatorTokenType|AltExtTokenType))
    {
        BOOST_WAVE_THROW(preprocess_exception, invalid_macroname,
            impl::get_full_name(begin, end).c_str(), main_pos);
    }

IteratorT it = begin;
error line >>>>>> string_type name ((*it).get_value()); <<<<<< error line
typename defined_macros_type::iterator cit(current_macros -> find(name));

    if (++it != end) {
    // there should be only one token as the inspected name
        BOOST_WAVE_THROW(preprocess_exception, invalid_macroname,
            impl::get_full_name(begin, end).c_str(), main_pos);
    }
    return cit != current_macros -> end();
}

I assume compiler dereferences iterator to char and char has no member to get_value. Does anyone
have suggestions?

With Kind Regards,

Ovanes Markarian


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