All pastes #636111 Raw Edit

Someone

public text v1 · immutable
#636111 ·published 2007-07-27 16:58 UTC
rendered paste body
#ifndef WCL_Set_HH
#define WCL_Set_HH

#include<WCL/Iterator.hh>
#include<WCL/Opt.hh>

#include <set>

namespace WCL {

namespace _private_Set {

//=====================================================================================================================
template<class T>
class Set : private std::set<internal::::_Opt<T> > {
  // Typedefs ---------------------------------------------------------------------------------------------------------
  private:typedef   std::set<internal::::_Opt<T> > Super;
          typedef   Set<T>                         Self;
  // Constructors -----------------------------------------------------------------------------------------------------
  public: Set()   : Super() {}
  private:Set(Set const&);
  public:~Set() {}
  // Find -------------------------------------------------------------------------------------------------------------
  public: bool have(T const& t) const { return Super::count(&t) > 0; }
  //-------------------------------------------------------------------------------------------------------------------
  public: TEMPLATE_ITERATOR_BASE_IMPL(Super,T,Get_Ptr)
  //-------------------------------------------------------------------------------------------------------------------
  public: void  remove(iterator i) { Super::erase(i.ref()); }
          void  remove(T const& t) { Super::erase(&t);      }
          void  insert(T& t)       { Super::insert(&t);     }
  public: using Super::clear;
          using Super::empty;
          using Super::size;
};

}
#endif