Chris@16: #ifndef BOOST_SERIALIZATION_PFTO_HPP Chris@16: #define BOOST_SERIALIZATION_PFTO_HPP Chris@16: Chris@16: // MS compatible compilers support #pragma once Chris@101: #if defined(_MSC_VER) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 Chris@16: // pfto.hpp: workarounds for compilers which have problems supporting Chris@16: // Partial Function Template Ordering (PFTO). Chris@16: Chris@16: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org/libs/serialization for updates, documentation, and revision history. Chris@16: // PFTO version is used to specify the last argument of certain functions Chris@16: // Function it is used to support compilers that fail to support correct Partial Chris@16: // Template Ordering Chris@16: #include Chris@16: Chris@16: // some compilers can use an exta argument and use function overloading Chris@16: // to choose desired function. This extra argument is long in the default Chris@16: // function implementation and int for the rest. The function is called Chris@16: // with an int argument. This first attempts to match functions with an Chris@16: // int argument before the default one (with a long argument). This is Chris@16: // known to function with VC 6.0. On other compilers this fails (Borland) Chris@16: // or causes other problems (GCC). note: this Chris@16: Chris@16: #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) Chris@16: #define BOOST_PFTO long Chris@16: #else Chris@16: #define BOOST_PFTO Chris@16: #endif Chris@16: Chris@16: // here's another approach. Rather than use a default function - make sure Chris@16: // there is no default at all by requiring that all function invocations Chris@16: // have a "wrapped" argument type. This solves a problem with VC 6.0 Chris@16: // (and perhaps others) while implementing templated constructors. Chris@16: Chris@16: namespace boost { Chris@16: namespace serialization { Chris@16: Chris@16: template Chris@16: struct pfto_wrapper { Chris@16: const T & t; Chris@16: operator const T & (){ Chris@16: return t; Chris@16: } Chris@16: pfto_wrapper (const T & rhs) : t(rhs) {} Chris@16: }; Chris@16: Chris@16: template Chris@16: pfto_wrapper< T > make_pfto_wrapper(const T & t, BOOST_PFTO int){ Chris@16: return pfto_wrapper< T >(t); Chris@16: } Chris@16: Chris@16: template Chris@16: pfto_wrapper< T > make_pfto_wrapper(const pfto_wrapper< T > & t, int){ Chris@16: return t; Chris@16: } Chris@16: Chris@16: } // namespace serialization Chris@16: } // namespace boost Chris@16: Chris@16: #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING Chris@16: #define BOOST_PFTO_WRAPPER(T) \ Chris@16: boost::serialization::pfto_wrapper< T > Chris@16: #define BOOST_MAKE_PFTO_WRAPPER(t) \ Chris@16: boost::serialization::make_pfto_wrapper(t, 0) Chris@16: #else Chris@16: #define BOOST_PFTO_WRAPPER(T) T Chris@16: #define BOOST_MAKE_PFTO_WRAPPER(t) t Chris@16: #endif Chris@16: Chris@16: #endif // BOOST_SERIALIZATION_PFTO_HPP