See http://svn.boost.org/svn/boost/trunk/boost/smart_ptr/shared_... as an example of reference counting. Add in some atomic increment/decrement primitives and that's literally all there is to implement in one header file.
But even the lightest weight GC collector I could make had a significant C++ implementation file with lots of nontrivial pointer operations and loops in it. Even without scanning the stack for root objects, passing them in manually, I still think there's some amount of non-portable code in there.
That said, I'm using my GC for new stuff when the objects aren't too temporary. We'll see how it works out.
Not sure which thing you're saying "I haven't really". But yeah, at times I have experimented with code that replaced built-in C++-runtime-library functionality.
(don't forget what you're piggy-backing on when the compiler is invoking ctors and dtors for you too).
Ctor/dtors by themselves don't, by themselves, generally allocate heap objects.
Boost shared pointers are toys; they don't deal with copy-on-write semantics.
I don't think that CoW is an essential feature of every allocation tracking scheme. Still, if you declare shared_ptr<const T> you can copy when you need to.
The std::unique_ptr and "move" semantics in C++11 are filling in some of those gaps in the core language.
C++ exception safety is also hilariously difficult to get right (this adds to the refcounting problem)
Be honest - it is exceptional conditions in all forms of programming are "hilariously difficult". C programs typically handle it sporadically or dedicate 50% of the code bulk (evenly throughout the program) to handling such conditions. C++ exceptions are tools to help you to put all that danger into a single facility which you can then point to and be horrified by. This is a great improvement.
the language is broken by design.
As someone else once replied to me, Yeah, if your definition of broken is awesome. :-)
It just depends on what you want out of your language. I like other languages too.
Alternatively, you could implement a simple first-fit free-block-list scheme in a small amount of code. It might not look terribly different from something a GC might do anyway.
Still, I think it's a fair point.
(Delphi uses reference counting for interfaces, strings and dynamic arrays, and I am aware of race bugs in strings in particular (which are copy on write); these bugs are hard to fix without murdering performance, yet in practice they are very rare on x86 memory model hardware. So they stay.)