A
A
afiskon2011-08-13 12:29:11
C++ / C#
afiskon, 2011-08-13 12:29:11

How to create a wrapper around new in c++?

I know that c++ allows you to override the new operator, but I need something different. I would like to make a smartNew operator that will work exactly like new, except that it returns smart pointers. A non-template solution comes to mind (to get sizeof), but perhaps someone already has a decent solution?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
ixSci, 2011-08-14
@ixSci

auto Object = std::make_shared

X
xanep, 2011-08-13
@xanep

And what problem do you want to solve with an operator that returns smart pointers?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question