|
Boost Users : |
Subject: [Boost-users] [Proto] Failed to Mimic the "Lazy Vector" Example
From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2010-12-08 13:10:51
Dear all,
Trying to mimic what comes in the Lazy Vector example
http://www.boost.org/doc/libs/1_45_0/doc/html/proto/users_guide.html#boost_proto.users_guide.examples
I get a strange error speaking about result_of and the like. My guess is that there is some specialisation of a function object which does do the job for std::vector<> that I need to also specialise for my class. I can't find any track of that thing though. And, I might be totally wrong too...
Anyway, for your reference, I have put the code as well as the error message that I get in GCC 4.5.1, MinGW, WinXP, SP3 in the PS section of this posting. Any ideas please?
TIA,--Hossein
<Code>
#include <iostream>
#include <boost/proto/proto.hpp>
namespace mpl = boost::mpl;
namespace proto = boost::proto;
using proto::_;
struct EWBase {};
typedef proto::terminal<double (*) (double)> FunctionType;
struct EmtGrammar:
proto::or_
<
proto::terminal<EWBase>,
proto::shift_right<EmtGrammar, FunctionType>
>
{};
struct EmtDomain;
template<typename Expr>
struct EmtExpr
: proto::extends<Expr, EmtExpr<Expr>, EmtDomain>
{
typedef proto::extends<Expr, EmtExpr<Expr>, EmtDomain> base_type;
EmtExpr( Expr const & expr = Expr() )
: base_type( expr )
{}
};
template< typename T >
struct Emt
: EmtExpr<typename proto::terminal<EWBase>::type>
{
typedef typename proto::terminal<EWBase>::type expr_type;
Emt(): EmtExpr<expr_type>(expr_type::make(EWBase())) {}
};
struct EmtDomain
: proto::domain<proto::generator<EmtExpr>, EmtGrammar>
{};
int main()
{
return 0;
}
</Code>
<Error Message>
-------------- Build: Debug in ProtoGame2 ---------------
Compiling: main.cpp
In file included from D:\Sources\Boost\boost_1_42_0/boost/proto/traits.hpp:34:0,
from D:\Sources\Boost\boost_1_42_0/boost/proto/expr.hpp:27,
from D:\Sources\Boost\boost_1_42_0/boost/proto/core.hpp:17,
from D:\Sources\Boost\boost_1_42_0/boost/proto/proto.hpp:12,
from D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:3:
D:\Sources\Boost\boost_1_42_0/boost/utility/result_of.hpp: In instantiation of 'boost::detail::result_of_nested_result<EmtDomain, EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<const EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>)>':
D:\Sources\Boost\boost_1_42_0/boost/utility/result_of.hpp:75:1: instantiated from 'boost::detail::result_of_impl<EmtDomain, EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<const EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>), false>'
D:\Sources\Boost\boost_1_42_0/boost/utility/detail/result_of_iterate.hpp:24:109: instantiated from 'boost::result_of<EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<const EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>)>'
D:\Sources\Boost\boost_1_42_0/boost/preprocessor/iteration/detail/local.hpp:34:1: instantiated from 'boost::proto::exprns_::extends<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l>, EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >, EmtDomain, 0l>'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:25:1: instantiated from 'EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:36:1: instantiated from here
D:\Sources\Boost\boost_1_42_0/boost/utility/result_of.hpp:68:1: error: invalid use of incomplete type 'struct EmtDomain'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:20:8: error: forward declaration of 'struct EmtDomain'
In file included from D:\Sources\Boost\boost_1_42_0/boost/proto/extends.hpp:533:0,
from D:\Sources\Boost\boost_1_42_0/boost/proto/core.hpp:23,
from D:\Sources\Boost\boost_1_42_0/boost/proto/proto.hpp:12,
from D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:3:
D:\Sources\Boost\boost_1_42_0/boost/preprocessor/iteration/detail/local.hpp: In instantiation of 'boost::proto::exprns_::extends<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l>, EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >, EmtDomain, 0l>':
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:25:1: instantiated from 'EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:36:1: instantiated from here
D:\Sources\Boost\boost_1_42_0/boost/preprocessor/iteration/detail/local.hpp:34:1: error: no type named 'type' in 'struct boost::result_of<EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<const EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>)>'
In file included from D:\Sources\Boost\boost_1_42_0/boost/proto/traits.hpp:34:0,
from D:\Sources\Boost\boost_1_42_0/boost/proto/expr.hpp:27,
from D:\Sources\Boost\boost_1_42_0/boost/proto/core.hpp:17,
from D:\Sources\Boost\boost_1_42_0/boost/proto/proto.hpp:12,
from D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:3:
D:\Sources\Boost\boost_1_42_0/boost/utility/result_of.hpp: In instantiation of 'boost::detail::result_of_nested_result<EmtDomain, EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>)>':
D:\Sources\Boost\boost_1_42_0/boost/utility/result_of.hpp:75:1: instantiated from 'boost::detail::result_of_impl<EmtDomain, EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>), false>'
D:\Sources\Boost\boost_1_42_0/boost/utility/detail/result_of_iterate.hpp:24:109: instantiated from 'boost::result_of<EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>)>'
D:\Sources\Boost\boost_1_42_0/boost/preprocessor/iteration/detail/local.hpp:34:1: instantiated from 'boost::proto::exprns_::extends<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l>, EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >, EmtDomain, 0l>'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:25:1: instantiated from 'EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:36:1: instantiated from here
D:\Sources\Boost\boost_1_42_0/boost/utility/result_of.hpp:68:1: error: invalid use of incomplete type 'struct EmtDomain'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:20:8: error: forward declaration of 'struct EmtDomain'
In file included from D:\Sources\Boost\boost_1_42_0/boost/proto/extends.hpp:533:0,
from D:\Sources\Boost\boost_1_42_0/boost/proto/core.hpp:23,
from D:\Sources\Boost\boost_1_42_0/boost/proto/proto.hpp:12,
from D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:3:
D:\Sources\Boost\boost_1_42_0/boost/preprocessor/iteration/detail/local.hpp: In instantiation of 'boost::proto::exprns_::extends<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l>, EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >, EmtDomain, 0l>':
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:25:1: instantiated from 'EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >'
D:\My Documents\My Programmes\Tutorial\Proto\ProtoGame2\main.cpp:36:1: instantiated from here
D:\Sources\Boost\boost_1_42_0/boost/preprocessor/iteration/detail/local.hpp:34:1: error: no type named 'type' in 'struct boost::result_of<EmtDomain(boost::proto::exprns_::expr<boost::proto::tag::function, boost::proto::argsns_::list1<EmtExpr<boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<EWBase>, 0l> >&>, 1l>)>'
Process terminated with status 1 (0 minutes, 2 seconds)
6 errors, 0 warnings
</Error Message>
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