#include <iostream>
#include <vector>
#include <memory>
#include <random>
#include <array>


struct a
{
    virtual ~a() = default;
};

struct b : public a {};
struct c : public a {};


using pointer_type = std::unique_ptr<a>;
using vector_type = std::vector<pointer_type>;

pointer_type random_class()
{
    static std::mt19937 gen((std::random_device())());
    std::uniform_int_distribution<unsigned> dist(0, 2);

    switch (dist(gen))
    {
    case 0: return pointer_type(new a);
    case 1: return pointer_type(new b);
    case 2: return pointer_type(new c);
    }
}

const char* identity(const a* object)
{
    if (const c* o = dynamic_cast<const c*>(object))
        return "c";

    if (const b* o = dynamic_cast<const b*>(object))
        return "b";

    return "a";
}

template<typename iter_type>
void display(iter_type beg, iter_type end)
{
    std::cout << "{ ";
    while (beg != end)
        std::cout << identity((beg++)->get()) << ' ';
    std::cout << "}\n";
}


int main()
{
    vector_type v;
    for (unsigned i = 0; i < 10; ++i)
        v.emplace_back(random_class());

    display(v.begin(), v.end());
}