Skip to content

Instantly share code, notes, and snippets.

@pocketberserker
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pocketberserker/e65189f78f398a145ddd to your computer and use it in GitHub Desktop.
Save pocketberserker/e65189f78f398a145ddd to your computer and use it in GitHub Desktop.
函数型なんたらの集い関連 発表者抽選用
#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