|
Boost : |
From: Cromwell Enage (sponage_at_[hidden])
Date: 2004-09-25 23:45:04
Methinks I found the problem, not in numeric_cast, but
in the numeric ops themselves.
The divides metafunction, for example, inherits from
the apply template nested inside the divides_impl
template. The problem is that the primary
divides_impl template inherits from if_c, which
doesn't have a nested apply template, although its
argument types do. The same type of problem occurs in
all other numeric ops, including the comparison ops.
Changing the primary *_impl template for each numeric
op to something like the following code should
vanquish the problem. (It did for me when I edited
the appropriate files.)
template <typename Tag1, typename Tag2>
struct NUMERIC_OP_IMPL
{
template <typename N1, typename N2>
struct apply
{
BOOST_STATIC_CONSTANT(
bool,
cond =
BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) >
BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
);
typedef typename
eval_if_c<
cond,
identity<N1>,
apply_wrap1<
BOOST_MPL_AUX_NUMERIC_CAST<
Tag1,Tag2
>,
N1
>
>::type
n_1;
typedef typename
eval_if_c<
cond,
apply_wrap1<
BOOST_MPL_AUX_NUMERIC_CAST<
Tag1,Tag2
>,
N2
>,
identity<N2>
>::type
n_2;
typedef typename
apply_wrap2<
NUMERIC_OP_IMPL<
typename n_1::tag,
typename n_2::tag
>,
n_1,
n_2
>::type
type;
};
};
Some preprocessed files may need similar editing so
that other compilers (which I don't have) will also
succeed.
I may be offline for a while, as I'm about to ride out
yet another hurricane.
HTH
Cromwell Enage
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk