From 807fc1443a3ac64c24d9bef5428f46f59437b459 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Sat, 5 Jun 2010 11:06:13 +0000 Subject: [PATCH] also use TR1 code for bind and shared_ptr when compiling with GCC >= 4.4 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34600 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferList.cpp | 2 +- src/support/bind.h | 9 ++++++++- src/support/checktr1.h | 24 ++++++++++++++++++++++++ src/support/shared_ptr.h | 9 ++++++++- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 src/support/checktr1.h diff --git a/src/BufferList.cpp b/src/BufferList.cpp index 43e81316a6..f9a89f78b2 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -37,7 +37,7 @@ #include #include #include - +#include using namespace std; using namespace lyx::support; diff --git a/src/support/bind.h b/src/support/bind.h index 6d3d83e9ad..f613bdb408 100644 --- a/src/support/bind.h +++ b/src/support/bind.h @@ -12,10 +12,17 @@ #ifndef LYX_BIND_H #define LYX_BIND_H -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#include "checktr1.h" + + +#ifdef LYX_USE_TR1 #include +#ifdef __GNUC__ +#include +#endif + namespace lyx { using std::tr1::bind; diff --git a/src/support/checktr1.h b/src/support/checktr1.h new file mode 100644 index 0000000000..9a4d23cc90 --- /dev/null +++ b/src/support/checktr1.h @@ -0,0 +1,24 @@ +// -*- C++ -*- +/** + * \file checktr1.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Peter Kümmel + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef LYX_CHECKTR1_H +#define LYX_CHECKTR1_H + +#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#define LYX_USE_TR1 +#endif + +#if __GNUC__ == 4 && __GNUC_MINOR__ >= 4 +#define LYX_USE_TR1 +#endif + + +#endif diff --git a/src/support/shared_ptr.h b/src/support/shared_ptr.h index a671211a5c..454360ee4c 100644 --- a/src/support/shared_ptr.h +++ b/src/support/shared_ptr.h @@ -12,10 +12,17 @@ #ifndef LYX_SHARED_PTR_H #define LYX_SHARED_PTR_H -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#include "checktr1.h" + + +#ifdef LYX_USE_TR1 #include +#ifdef __GNUC__ +#include +#endif + namespace lyx { using std::tr1::shared_ptr; -- 2.39.5