Dear all,
I have a piece of code in which contains:
template
void FuncStreamCtx::operator () (tag::shift_right, const L& l, const R& r) const
{
evaluate_helper(l, *this);
const typename result_of::value<R>::type f = value(r);
}
When I compile this under GCC 4.5.1 (MinGW, WinXP, SP3), I get a large spew of warnings. My related piece of code which I guess would be helpful is:
double plus1(double i) {return i + 1;}
double plus2(double i) {return i + 2;}
struct FuncStreamCtx: callable_context
{
FuncStreamCtx() {}
typedef void result_type;
void operator () (tag::terminal, double) const;
template
void operator () (tag::shift_right, const L&, const R&) const;
const vector<double>& state() const {return data_;}
private:
void set_single_value(double) const;
mutable vector<double> data_;
};
template<typename Expr>
const vector<double>& evaluate_helper(const Expr& e, const FuncStreamCtx& ctx)
{
boost::proto::eval(e, ctx);
return ctx.state();
}
template<typename Expr>
void evaluate(const Expr& e, vector<double>& v)
{
const FuncStreamCtx ctx;
v = evaluate_helper(e, ctx);
}
template
void FuncStreamCtx::operator () (tag::shift_right, const L& l, const R& r) const
{
evaluate_helper(l, *this);
const typename result_of::value<R>::type f = value(r);
}
int main()
{
vector<double> v;
evaluate(lit(51.6) >> &plus2 >> &plus2 >> &plus1, v);
cout << "Result = ";
copy(v.begin(), v.end(), ostream_iterator<double>(cout, " "));
return 0;
}
I have also included the warnings in the P.S. Any idea what the compiler is saying? And, should I do anything about it?
TIA,
--Hossein
P.S.
-------------- Build: Debug in ProtoGame3 ---------------
Compiling: main.cpp
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp: In member function 'void FuncStreamCtx::operator()(boost::proto::tag::shift_right, const L&, const R&) const [with L = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, R = boost::proto::exprns_::expr, 0l>]':
D:\Sources\Boost\boost_1_42_0/boost/proto/context/callable.hpp:313:21: instantiated from 'boost::proto::context::callable_eval::result_type boost::proto::context::callable_eval::operator()(Expr&, Context&) const [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = const FuncStreamCtx, boost::proto::context::callable_eval::result_type = void]'
D:\Sources\Boost\boost_1_42_0/boost/proto/eval.hpp:100:62: instantiated from 'typename boost::proto::result_of::eval::type boost::proto::eval(Expr&, const Context&) [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context =
FuncStreamCtx, typename boost::proto::result_of::eval::type = void]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:44:2: instantiated from 'const std::vector<double>& evaluate_helper(const Expr&, const FuncStreamCtx&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:52:2: instantiated from 'void evaluate(const Expr&, std::vector<double>&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:80:53: instantiated from here
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:74:43: warning: unused variable 'f'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp: In member function 'void FuncStreamCtx::operator()(boost::proto::tag::shift_right, const L&, const R&) const [with L = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>, R = boost::proto::exprns_::expr, 0l>]':
D:\Sources\Boost\boost_1_42_0/boost/proto/context/callable.hpp:313:21: instantiated from 'boost::proto::context::callable_eval::result_type boost::proto::context::callable_eval::operator()(Expr&, Context&) const [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = const FuncStreamCtx, boost::proto::context::callable_eval::result_type = void]'
D:\Sources\Boost\boost_1_42_0/boost/proto/eval.hpp:100:62: instantiated from 'typename boost::proto::result_of::eval::type boost::proto::eval(Expr&, const Context&) [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = FuncStreamCtx, typename boost::proto::result_of::eval::type = void]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:44:2: instantiated from 'const std::vector<double>& evaluate_helper(const Expr&, const FuncStreamCtx&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:73:2: instantiated from 'void FuncStreamCtx::operator()(boost::proto::tag::shift_right, const L&, const R&) const [with L = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, R = boost::proto::exprns_::expr, 0l>]'
D:\Sources\Boost\boost_1_42_0/boost/proto/context/callable.hpp:313:21: instantiated from 'boost::proto::context::callable_eval::result_type boost::proto::context::callable_eval::operator()(Expr&, Context&) const [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = const FuncStreamCtx, boost::proto::context::callable_eval::result_type = void]'
D:\Sources\Boost\boost_1_42_0/boost/proto/eval.hpp:100:62: instantiated from 'typename boost::proto::result_of::eval::type boost::proto::eval(Expr&, const Context&) [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context =
FuncStreamCtx, typename boost::proto::result_of::eval::type = void]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:44:2: instantiated from 'const std::vector<double>& evaluate_helper(const Expr&, const FuncStreamCtx&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:52:2: instantiated from 'void evaluate(const Expr&, std::vector<double>&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:80:53: instantiated from here
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:74:43: warning: unused variable 'f'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp: In member function 'void FuncStreamCtx::operator()(boost::proto::tag::shift_right, const L&, const R&) const [with L = boost::proto::utility::literal, R = boost::proto::exprns_::expr, 0l>]':
D:\Sources\Boost\boost_1_42_0/boost/proto/context/callable.hpp:313:21: instantiated from 'boost::proto::context::callable_eval::result_type boost::proto::context::callable_eval::operator()(Expr&, Context&) const [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = const FuncStreamCtx, boost::proto::context::callable_eval::result_type = void]'
D:\Sources\Boost\boost_1_42_0/boost/proto/eval.hpp:100:62: instantiated from 'typename boost::proto::result_of::eval::type boost::proto::eval(Expr&, const Context&) [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = FuncStreamCtx, typename boost::proto::result_of::eval::type = void]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:44:2: instantiated from 'const std::vector<double>& evaluate_helper(const Expr&, const FuncStreamCtx&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:73:2: instantiated from 'void FuncStreamCtx::operator()(boost::proto::tag::shift_right, const L&, const R&) const [with L = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>, R = boost::proto::exprns_::expr, 0l>]'
D:\Sources\Boost\boost_1_42_0/boost/proto/context/callable.hpp:313:21: instantiated from 'boost::proto::context::callable_eval::result_type boost::proto::context::callable_eval::operator()(Expr&, Context&) const [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = const FuncStreamCtx, boost::proto::context::callable_eval::result_type = void]'
D:\Sources\Boost\boost_1_42_0/boost/proto/eval.hpp:100:62: [ skipping 2 instantiation contexts ]
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:73:2: instantiated from 'void FuncStreamCtx::operator()(boost::proto::tag::shift_right, const L&, const R&) const [with L = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, R = boost::proto::exprns_::expr, 0l>]'
D:\Sources\Boost\boost_1_42_0/boost/proto/context/callable.hpp:313:21: instantiated from 'boost::proto::context::callable_eval::result_type boost::proto::context::callable_eval::operator()(Expr&, Context&) const [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context = const FuncStreamCtx, boost::proto::context::callable_eval::result_type = void]'
D:\Sources\Boost\boost_1_42_0/boost/proto/eval.hpp:100:62: instantiated from 'typename boost::proto::result_of::eval::type boost::proto::eval(Expr&, const Context&) [with Expr = const boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>, Context =
FuncStreamCtx, typename boost::proto::result_of::eval::type = void]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:44:2: instantiated from 'const std::vector<double>& evaluate_helper(const Expr&, const FuncStreamCtx&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:52:2: instantiated from 'void evaluate(const Expr&, std::vector<double>&) [with Expr = boost::proto::exprns_::expr&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>&, boost::proto::exprns_::expr, 0l> >, 2l>]'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:80:53: instantiated from here
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame3\main.cpp:74:43: warning: unused variable 'f'
Linking console executable: bin\Debug\ProtoGame3.exe
Output size is 1.08 MB
Process terminated with status 0 (0 minutes, 4 seconds)
1 errors, 3 warnings