Ignore:
Timestamp:
Mar 11, 2010, 3:17:29 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
1e0785
Parents:
e9f2e1
Message:

Small improvements to singleton pattern

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Patterns/Singleton_impl.hpp

    re9f2e1 r97f035  
    7777}
    7878
     79template<class T, bool _may_create>
     80Singleton<T,_may_create>::Singleton(){/* empty */}
     81
     82// private copy constructor to avoid unintended copying
     83template <class T, bool _may_create>
     84Singleton<T,_may_create>::Singleton(const Singleton<T,_may_create>&){
     85  assert(0 && "Copy constructor of singleton template called");
     86}
     87
    7988/**
    8089 * This define allows simple instantiation of the necessary singleton functions
     
    121130
    122131template <class T,bool _may_create>
    123 typename Singleton<T,_may_create>::ptr_t& Singleton<T,_may_create>::ptr_t::operator=(typename Singleton<T,_may_create>::ptr_t& rhs){
     132typename Singleton<T,_may_create>::ptr_t& Singleton<T,_may_create>::ptr_t::operator=(const typename Singleton<T,_may_create>::ptr_t& rhs){
    124133  if(&rhs!=this){
    125134    delete content;
Note: See TracChangeset for help on using the changeset viewer.