How to use autoconf with C++0x features
- by themis
What are the best practices for using autoconf in conjunction
with shared_ptr and other TR1/BOOST C++0x templates so as to maximize
portability and maintainability?
With autoconf I can determine whether shared_ptr is
available as std::tr1::shared_ptr and/or boost::shared_ptr. Given
that the same feature has two different names, I have the following
questions:
In the code, how should shared_ptr be referenced?
Should std::tr1::shared_ptr be preferred over boost::shared_ptr?
For the first, the code is currently using preprocessor conditionals
allowing non-qualified references to shared_ptr, a la
#if HAVE_STD_TR1_SHARED_PTR
using std::tr1::shared_ptr;
#elif HAVE_BOOST_SHARED_PTR
using boost::shared_ptr;
#else
#error "No definition for shared_ptr found"
#endif
Second, the code uses std::tr1:: over boost:: to minimize
dependencies on external libraries (even if the the libraries are
widely used).
Are these two solutions common? Are there better ones?