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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -