Last active
August 29, 2015 14:06
-
-
Save pocketberserker/e65189f78f398a145ddd to your computer and use it in GitHub Desktop.
函数型なんたらの集い関連 発表者抽選用
This file contains 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 <sstream> | |
#include <vector> | |
#include <iterator> | |
#include <random> | |
#include <boost/assign/list_of.hpp> | |
#include <boost/range/algorithm/copy.hpp> | |
#include <boost/range/adaptor/indexed.hpp> | |
#include <boost/range/adaptor/transformed.hpp> | |
std::string to_string(const boost::tuple<int, std::string>& data) | |
{ | |
std::ostringstream str; | |
str << data.get<0>() << ": " << data.get<1>(); | |
return str.str(); | |
} | |
int main() { | |
using namespace boost::adaptors; | |
std::random_device rdev; | |
std::mt19937 engine(rdev()); | |
std::vector<std::string> speakers = boost::assign::list_of | |
("its_out_of_tune") | |
("kmizu") | |
("masterq") | |
("ruicc") | |
("esehara") | |
("nobkz") | |
("pab_tech") | |
("xuwei_k"); | |
std::shuffle(speakers.begin(), speakers.end(), engine); | |
boost::copy( | |
speakers | indexed(1) | transformed(to_string), | |
std::ostream_iterator<std::string>(std::cout, "\n")); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment