|
Boost : |
From: Drazen DOTLIC (Drazen.Dotlic_at_[hidden])
Date: 2003-07-11 13:58:07
> > Btw, VC7.1 does not seem to like identity in this (and
> David's) scenario
> > - it complains that it does not have inner typedef to type,
> even though
> > it does.
>
> Can you please post a small example which fails?
Well, your own :) from few hours ago, used something like this (btw, I
am using CVS snapshot as of, say, 2 weeks ago):
template<typename Result, TypeVector>
class Useful
{
public:
typedef typename type_at_non_strict_c<TypeVector, 0>::type Param1;
typedef typename type_at_non_strict_c<TypeVector, 1>::type Param2;
typedef typename type_at_non_strict_c<TypeVector, 2>::type Param3;
}
Blatant copy from your mail plus small typo (size_t_c to size_t only)
corrected:
template <class S, class N>
struct type_at_non_strict
: mpl::apply_if<
mpl::greater<mpl::size<S>,N>
, mpl::at<S,N>
, mpl::identity<mpl::void_>
>
{};
template <class S, std::size_t N>
struct type_at_non_strict_c
: type_at_non_strict<S, mpl::size_t<N> >
{};
If I do not replace identity with void_ only, I get the following (nice
VC71 elaborate error report):
c:\projects\tools\boost\boost\mpl\apply_if.hpp(39) : error C2039: 'type'
: is not a member of 'boost::mpl::identity<boost::mpl::void_>'
c:\projects\tools\boost\boost\mpl\identity.hpp(44) : see declaration of
'boost::mpl::identity<boost::mpl::void_>'
c:\projects\mylib\MetaProgramming.h(26) : see reference to class
template instantiation 'boost::mpl::apply_if<C,F1,F2>' being compiled
with
[
C=boost::mpl::greater<boost::mpl::size<boost::mpl::vector<bool>>,boost::
mpl::size_t<1>>,
F1=boost::mpl::at<boost::mpl::vector<bool>,boost::mpl::size_t<1>>,
F2=boost::mpl::identity<boost::mpl::void_>
]
c:\projects\mylib\MetaProgramming.h(34) : see reference to class
template instantiation 'type_at_non_strict<TypeContainer,N>' being
compiled
with
[
TypeContainer=boost::mpl::vector<bool>,
N=boost::mpl::size_t<1>
]
c:\projects\mylib\Useful.h(37) : see reference to class template
instantiation 'type_at_non_strict_c<TypeContainer,N>' being compiled
with
[
TypeContainer=boost::mpl::vector<bool>,
N=1
]
c:\projects\mylib\Used.h(45) : see reference to class template
instantiation 'Useful<Result,TypeVector>' being compiled
with
[
Result=bool,
TypeVector=boost::mpl::vector<bool>
]
I tried to replace company/project specific names with generic ones,
hope I did not ruin the example.
Drazen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk