PrevUpHomeNext

Extendible Unique-Entry Collection

The implementation file:

using   All = std::map<std::string, Book>;
using Mutex = boost::mutex;
using  Lock = boost::mutex::scoped_lock;

Book::Book(std::string const& title) : impl_ptr_type(nullptr)
{
   static Mutex mutex;
   static All   books;
   Lock          lock (mutex);
   auto        result = books.emplace(title, boost::impl_ptr<Book>::null());
   Book&         book = result.first->second;

   if (result.second)
       book.emplace(args);

   *this = book;
}

PrevUpHomeNext