#include <iostream>
#include <vector>
#include <type_traits>
#include <memory>

class Light{};
class PointLight: public Light{};
class DirectionalLight: public Light{};

std::vector< std::unique_ptr<Light> > lights;

template<typename T>
void CreateLight()
{
   static_assert(std::is_base_of<Light, T>::value, "Type must of descendant of type Light. ");
   // store to vector directly
   lights.emplace_back( std::make_unique<T>(/*args*/));
}

int main()
{
   CreateLight<PointLight>();

   //Either directly
   auto iter = lights.rbegin();
   if(*iter) std::cout << "Done\n";


   return 0;
}