🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #1118

Re: unnamed namespaces in CW5.3

#1118
From: Adin Hunter Baber
Date: Fri, 26 Oct 2001 08:30
70 lines
3033 bytes
In article <macdev-B6C0DF.19501624102001@senator-bedfellow.mit.edu>,
 meeroh <macdev@meeroh.org> wrote:

> In article 
> <mjolnir_DELETE_-3E19C3.18315324102001@east.usenetserver.com>,
>  Adin Hunter Baber <mjolnir_DELETE_@soltec.net> wrote:
> 
> >I guess I could just use a namespace BehindTheScenesStuffYouNoUse 
> 
> Or you could, like I said, post your code, so we can give you a more 
> appropriate solution. 
> 
> meeroh

namespace /*unnamed*/{

struct SmartBase
    {
    mutable int counter;
    
    SmartBase(const int i)
        :counter(i)
        {}
    virtual ~SmartBase() {}
    };
}// end namespace unnamed

namespace Adin{

template<class T>
struct Smart : public SmartBase
    {
    T           data;
    
    ~Smart() {}
    
    Smart()
      : SmartBase(0) {}
    Smart(const T &rt)
      : SmartBase(0), data(rt) {}
    Smart(      T &rt)
      : SmartBase(0), data(rt) {}

   // other constructors
   };

template<class T>
class SmartPointer
   {
   public:
      SmartPointer(Smart<T> *rt);
   // lots of other stuff
   };
}// end namespace Adin

According to my design, there is not any real reason for some to have a 
SmartBase in existance outside of this file's scope.

Basically, the code would be used this way:

SmartPointer<someClass> myptr = new Smart<someClass>(parameters);

If you are wondering, it is a smart pointer class that uses intrusive 
reference counting and handles polymorphism.

-- 
Adin Hunter Baber
"Death is lighter than a feather, Duty heavier than a mountain"
"...nevertheless, they fought on even though their homes were piles of ashes,
even though they knew they could not win they still fought on,..."
Technical Details
Message-ID: <mjolnir_DELETE_-A4247B.03301526102001@east.usenetserver.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjcppf01.usenetserver.com!e420r-sjo4.usenetserver.com!usenetserver.com!atlpnn01.usenetserver.com.POSTED!mjolnir_DELETE_
References: <mjolnir_DELETE_-8A9595.23380323102001@east.usenetserver.com> <macdev-854F03.01445224102001@senator-bedfellow.mit.edu> <mjolnir_DELETE_-3E19C3.18315324102001@east.usenetserver.com> <macdev-B6C0DF.19501624102001@senator-bedfellow.mit.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f635e,426dc3c68e8241c3
X-Google-Attributes: gidf635e,public
X-Google-Thread: 10bcce,426dc3c68e8241c3
X-Google-Attributes: gid10bcce,public
X-Google-ArrivalTime: 2001-10-26 01:34:03 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjcppf01.usenetserver.com!e420r-sjo4.usenetserver.com!usenetserver.com!atlpnn01.usenetserver.com.POSTED!mjolnir_DELETE_
From: Adin Hunter Baber <mjolnir_DELETE_@soltec.net>
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: Re: unnamed namespaces in CW5.3
Organization: Soltec
References: <mjolnir_DELETE_-8A9595.23380323102001@east.usenetserver.com> <macdev-854F03.01445224102001@senator-bedfellow.mit.edu> <mjolnir_DELETE_-3E19C3.18315324102001@east.usenetserver.com> <macdev-B6C0DF.19501624102001@senator-bedfellow.mit.edu>
Posted-And-Mailed: yes
User-Agent: MT-NewsWatcher/3.1 (PPC)
Message-ID: <mjolnir_DELETE_-A4247B.03301526102001@east.usenetserver.com>
Lines: 70
X-Complaints-To: abuse@usenetserver.com
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly.
NNTP-Posting-Date: Fri, 26 Oct 2001 04:28:38 EDT
Date: Fri, 26 Oct 2001 03:30:15 -0500