Le 06/06/2016 à 10:52, Rob Stewart a écrit :
On June 5, 2016 8:30:50 PM EDT, Edward Diener
wrote: On 6/5/2016 5:55 PM, Rob Stewart wrote:
It does involve more work and macros are still being used, although not to name the namespace. I honestly think that CXXD's solution is cleaner and more flexible. Lifting constructs which are normally accessed through one namespace to another namespace in that way seems to me a kludge. I am not sure of all the ramifications of doing this but I would be wary of doing such a thing myself. Vicente's approach, of I have it right, is pretty simple:
namespace boost { namespace something { using std::thread; // or (conditionally selected) using boost::thread; } }
With that, boost::something::thread is the name to use in the user's code.
The selection of what to import into the new namespace is managed by the preprocessor, so it can be overridden, too. Right.
My thought is generally that CXXD represents the easiest approach and that importing either side of a dual library's namespace into another common namespace, no matter how it is controlled, does not represent anything better than what CXXD has to offer. Allowing the user to just refer to boost::something::thread, rather than CXXD_THREAD::thread is less jarring to read, if nothing else. I don't think it offers much beyond that, though Vicente may have more information. Sometimes It allows to rename the minor differences. CXXD would be able to do that by adding a them to another namespace let me call it cxdd::xxx, import whatever is needed from boost and rename the minoir differences there. Then change the selected namespace for the macro.
Furthermore, although I haven't had the time or knowledge to work through all possible situations I believe that Vicente's approach could have problems involving customization points for a library, ADL, and/or template specializations. I don't think that's a problem for the library code itself and, since users are not generally permitted to open the std namespace, I don't think it would be a problem otherwise. Still, Vicente is best able to answer. Specialization are not permited in csbl namespace. This is why in both approached we need the additional macros I suggested for CXXD.
Best, Vicente