Boost logo

Boost :

Subject: [boost] [phoenix] local_reference problems
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-03 19:53:31


AMDG

The following code does not compile because phoenix tries to
call the % operator with the types:

boost::phoenix::detail::local_reference<boost::format> % int

What is the rationale for local_reference?

#include <boost/spirit/home/phoenix/operator.hpp>
#include <boost/spirit/home/phoenix/core.hpp>
#include <boost/spirit/home/phoenix/scope.hpp>

#include <boost/format.hpp>

#include <algorithm>
#include <vector>

using namespace boost::phoenix::arg_names;
using namespace boost::phoenix::local_names;
using namespace boost::phoenix;

int main() {
    std::vector<int> values(10);
    std::for_each(values.begin(), values.end(),
        let(_f = boost::format("value is %d = %d\n")) [
            std::cout << _f % _1 % _1
        ]
    );
}

C:\boost\trunk\boost/spirit/home/phoenix/operator/arithmetic.hpp(78) :
error C2676: binary '%' : 'const
boost::phoenix::detail::local_reference<T>' does not define this
operator or a conversion to a type acceptable to the predefined operator
        with
        [
            T=boost::basic_format<char>
        ]

In Christ,
Steven Watanabe


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