Back in 2016, I posted this little ditty about hiding the constructors but still enabling the use of "make_shared", this worked through a friendship between your class and the ref counter, but was sadly windows only.
At the time I promised the follow up for the same code for GNU, well I forgot, so here's the secret sauce, make your class as per that post, but friend it thus:
friend class __gnu_cxx::new_allocator<Foo>;
This only came up as I showed a colleague today and realized, I never got around to posting the other item!
No comments:
Post a Comment