Topic: Why new T() does not call operator& ()?


Author: Oleg Zabluda <zabluda@math.psu.edu>
Date: 1998/02/04
Raw View
Alexey N. Solofnenko <trelony@typhoon.spb.ru> wrote:
: Hi!

:   I am using simple ref-counter smart pointers with some objects and
: I am trying to force the programmer not to use them instead of T*.
: Unfortunately "new T()" always returns T*. I think it is strange. It
: would be more natural to ask the object what pointer it what to use.
: What do you think?

Hmm... nice point. I think you are right. For now make all
constructors for class T private, and allow T to be dynamically
created only with some other global function of yours, say

smart_ref<T> new_T();

or something.

Oleg.
--
Life is a sexually transmitted, 100% lethal disease.
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: "Alexey N. Solofnenko" <trelony@typhoon.spb.ru>
Date: 1998/01/27
Raw View
This is a multi-part message in MIME format.
--------------1C7C72D76444D745B62FD341
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit

Hi!

  I am using simple ref-counter smart pointers with some objects and I am trying to force the
programmer not to use them instead of T*. Unfortunately "new T()" always returns T*. I think it
is strange. It would be more natural to ask the object what pointer it what to use. What do you
think?

Best wishes,
  Alexey Solofnenko.


--------------1C7C72D76444D745B62FD341
Content-Type: text/x-vcard; charset=koi8-r; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Alexey N. Solofnenko
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Alexey N. Solofnenko
n:              Solofnenko;Alexey N.
org:            Typhoon Software, Inc.
adr:            ;;;St. Petersburg;;;Russia
email;internet: trelony@typhoon.spb.ru
title:          programmer
x-mozilla-cpt:  ;2
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------1C7C72D76444D745B62FD341--
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]