|
Boost Users : |
Subject: Re: [Boost-users] result_of protocol
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-02-26 05:37:24
-----Original Message-----
>From: "Hicham Mouline" [hicham_at_[hidden]]
>Date: 26/02/2010 09:40 AM
>To: boost-users_at_[hidden]
>Subject: Re: result_of protocol.
>----------------------------------------------------------------------------------
>struct extract_rule {
>
> template <typename Sig> struct result;
>
> template <typename Holder>
>struct result< extract_rule(const Holder) > {
> typedef const typename Holder::type& type;
> };
> template <typename Holder>
> typename result< extract_rule(const Holder) >::type
> operator()( const Holder& h ) const
> {
> return h.rule;
> }
>};
>----------------------------------------------------------------------------------
>1> with
>1> [
>1> Sig=extract_rule (const onevariantrule<parameters_t,0,boost::spirit::istream_iterator> )
>1> ]
>The template onevariantrule<> is defined _before_ extract_rule.
>-------------------------------------------------------------------------------------------
>template <typename parameters_t, unsigned n, typename Iterator>
>struct onevariantrule {
> typedef .... type;
>};
>-------------------------------------------------------------------------------------------
>Holder matches onevariantrule<parameters_t,0,boost::spirit::istream_iterator>.
>That template instantiation is indeed a class.
In the snippet above, I replaced Holder by what the compiler tells me it is in the error log, as
------------------------------------------------------------
struct extract_rule {
template <typename Sig> struct result;
template <typename Holder>
struct result< extract_rule(const Holder) > {
typedef const onevariantrule<parameters_t,0,boost::spirit::istream_iterator>::type& type;
};
------------------------------------------------------------
And this works.
If msvc is able to see that Holder is that particular template instantiation in the error log, isn't it able to know then that Holder is a class?
regards,
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