以下の内容はhttps://faithandbrave.hateblo.jp/entry/20090724/1248422972より取得しました。


mpl::foldでproductメタ関数

#include <boost/static_assert.hpp>
#include <boost/mpl/list_c.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/multiplies.hpp>

using namespace boost::mpl;

template <class Seq>
struct product {
    static const int value = fold<Seq, int_<1>, multiplies<_1, _2> >::type::value;
};

int main()
{
    typedef list_c<int, 1, 2, 3> ls;

    BOOST_STATIC_ASSERT(product<ls>::value == 6);
        // 1 * 1 * 2 * 3
}





以上の内容はhttps://faithandbrave.hateblo.jp/entry/20090724/1248422972より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14