/* Copyright 2016 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org/libs/poly_collection for library home page. */ /* basic usage of boost::base_collection */ #include #include #include #include "rolegame.hpp" int main() { //[basic_base_1 //= #include //= ... //= boost::base_collection c; std::mt19937 gen{92748}; // some arbitrary random seed std::uniform_real_distribution<> rnd; for(int i=0;i<8;++i){ // assign each type with 1/3 probability auto r=rnd(gen); if(r<1.0/3)c.insert(warrior{i}); else if(r<2.0/3)c.insert(juggernaut{i}); else c.insert(goblin{i}); } //] auto render=[&](){ //[basic_base_2 const char* comma=""; for(const sprite& s:c){ std::cout<