Inclusion of C++11 or TR1 header files

21 views
Skip to first unread message

Fernando Herrero Carrón

unread,
Jan 29, 2016, 1:11:00 PM1/29/16
to pialign-users
Hi everyone,

I am using pialign on a project and I find it very useful, thanks for the tool!

I am trying to compile it with clang 3.4.1 on FreeBSD 10.2, but when the compiler includes src/include/port/port.h it falls through the hole:


#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && \
  MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
#include <functional>
#include <unordered_map>
#include <unordered_set>
#else // Assuming older OS X, Linux or similar platforms
#include <tr1/functional>
#include <tr1/unordered_map>
#include <tr1/unordered_set>

The assumption that, because __APPLE__ is not defined we need to include tr1 is too strong, because clang++ has had support for c++11 for a very long time already.

The thing is: what is the best way to go about this? Checking for FreeBSD is not the best way, in my opinion, because a FreeBSD user may want to compile their code with an older gcc for whatever reason. Checking for Clang would be ok, but then maybe we should do the same for gcc >4.6, because they also support c++11 header files, and we may very soon have an explosion of possible platforms/compilers/versions.

Since the project seems to be happy with boost (though optionally), maybe Boost.Config would be a nice solution. Or maybe autoconf can check whether TR1 or plain C++11 headers are needed.

Besides this, I have manually removed the conditional inclusion and everything is compiling fine.

Thank you very much for your help.

Cheers,
Fernando

Graham Neubig

unread,
Jan 29, 2016, 1:15:13 PM1/29/16
to pialig...@googlegroups.com
Hi Fernando,

Thanks for the mail!
pialign hasn't been updated for a while, but I think it's now fair to assume that compilers will be able to support c++11. I don't have time to fix this at the moment, but if you send a pull request removing the old tr1 and compiling with c++11, I'll be happy to incorporate it.

Graham

--
You received this message because you are subscribed to the Google Groups "pialign-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pialign-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages