Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
函数型なんたらの集い関連 発表者抽選用
#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
std::shuffle(speakers.begin(), speakers.end(), engine);
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
You can’t perform that action at this time.