Created
March 26, 2012 02:30
-
-
Save eiiches/2202505 to your computer and use it in GitHub Desktop.
1から100までの整数の和を表示するプログラムを作れ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/mpl/range_c.hpp> | |
#include <boost/mpl/int.hpp> | |
#include <boost/mpl/plus.hpp> | |
#include <boost/mpl/fold.hpp> | |
using namespace boost; | |
int | |
main(int argc, char **argv) | |
{ | |
int x = mpl::fold< | |
mpl::range_c<int, 1, 100 + 1>, | |
mpl::int_<0>, | |
mpl::plus<mpl::_, mpl::_> | |
>::type::value; | |
std::cout << x << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment