Is it possible in any way (using C++ preprocessor etc) to replace shared_ptr<T> with T$, weak_ptr<T> with T%, and unique_ptr<T> with T? -
so far seems answer no.
which unfortunate given how more visually noisy code becomes shared_ptrs
on place.
with c++11, 1 possible way use aliases (which cleaner imo macros). e.g. shared pointers, do:
template<typename t> using shared = std::shared_ptr<t>;
then, use following:
shared<int> myint; // in fact std::shared_ptr<int>
edit: live example.
Comments
Post a Comment