Fix for systems that don't allow definitions of stl containers with incomplete types

Definitions of stl containers with incomplete type definitions, e.g. by
means of forward declarations, results in undefined behavior according
to the c++ standard. This corrects the problem by using providing an
alternative implementation using smart pointers selectable at configure
time by the user.