Boost logo

Boost :

From: Cromwell Enage (sponage_at_[hidden])
Date: 2004-05-21 08:25:23


Morning, all.

I'm trying to implement a compile-time greatest common
divisor metafunction, a key component of which is
boost::mpl::modulus_c. Am I correct if I say that the
following is typical usage of this class template?

#include <iostream>
#include <boost/mpl/modulus.hpp>

int main()
{
    typedef typename
boost::mpl::modulus<int,14,6>::type
            remainder_type;

    std::cout << "The remainder of 14 divided by 6 is
";
    std::cout << remainder_type::value << std::endl;

    return 0;
}

MinGW 3.2 accepts this usage, but MSVC 7.1 files the
following complaint:

..\..\Libraries\boost\boost\mpl\modulus.hpp(39) :
error C2975: 'N' : invalid template argument for
'boost::mpl::integral_c', compile-time evaluatable
constant expression expected

It seems MSVC doesn't recognize A % B as an integral
constant expression.

What's the proper way of handling this?

                              Cromwell Enage

        
                
__________________________________
Do you Yahoo!?
Yahoo! Domains – Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk