:
++ . gcc Visual Studio ( ) . , (.. , ), .
, std:: tr1, std. . , , . , , Visual Studio 10 / gcc, :
#include <list>
#include <string>
#include <tuple>
std::list<std::tuple<int, string> > time;
For example, with cmake, you can generate a header file that provides support for all compilers that support tuples (and with slightly greater efficiency even when using boost).
To do this, you will create something like a tuple.h.cmake file:
#if defined( __GNUC__ ) && (__GNUC__ * 100 + __GNUC_MINOR__ < 430)
# define GCC_OLDER_THAN_430 1
#endif
#if defined( _MSC_VER ) && (_MSC_VER < 1600 )
# define MSC_OLDER_THAN_2010 1
#endif
#if defined( GCC_OLDER_THAN_430 )
# define TR1_IN_TR1_SUBDIRECTORY 1
#endif
#if defined( ZORBA_GCC_OLDER_THAN_430 ) || defined( ZORBA_MSC_OLDER_THAN_2010 )
# define TR1_NS_IS_STD_TR1 1
#endif
#ifdef TR1_NS_IS_STD_TR1
# define TR1_NS std::tr1
#else
# define TR1_NS std
#endif
#ifdef TR1_IN_TR1_SUBDIRECTORY
# include <tr1/tuple>
#else
# include <tuple>
#endif
Then the above example would look like this:
#include <string>
#include <list>
#include "tuple.h"
std::list<TR1_NS::tuple<int, std::string> > time;
This should work with almost all recent compilers.
source
share