1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/pfto.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,74 @@
1.4 +#ifndef BOOST_PFTO_HPP
1.5 +#define BOOST_PFTO_HPP
1.6 +
1.7 +// MS compatible compilers support #pragma once
1.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
1.9 +# pragma once
1.10 +#endif
1.11 +
1.12 +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
1.13 +// pfto.hpp: workarounds for compilers which have problems supporting
1.14 +// Partial Function Template Ordering (PFTO).
1.15 +
1.16 +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
1.17 +// Use, modification and distribution is subject to the Boost Software
1.18 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1.19 +// http://www.boost.org/LICENSE_1_0.txt)
1.20 +
1.21 +// See http://www.boost.org for updates, documentation, and revision history.
1.22 +// PFTO version is used to specify the last argument of certain functions
1.23 +// Function it is used to support compilers that fail to support correct Partial
1.24 +// Template Ordering
1.25 +#include <boost/config.hpp>
1.26 +
1.27 +// some compilers can use an exta argument and use function overloading
1.28 +// to choose desired function. This extra argument is long in the default
1.29 +// function implementation and int for the rest. The function is called
1.30 +// with an int argument. This first attempts to match functions with an
1.31 +// int argument before the default one (with a long argument). This is
1.32 +// known to function with VC 6.0. On other compilers this fails (Borland)
1.33 +// or causes other problems (GCC). note: this
1.34 +
1.35 +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1.36 + #define BOOST_PFTO long
1.37 +#else
1.38 + #define BOOST_PFTO
1.39 +#endif
1.40 +
1.41 +// here's another approach. Rather than use a default function - make sure
1.42 +// there is no default at all by requiring that all function invocations
1.43 +// have a "wrapped" argument type. This solves a problem with VC 6.0
1.44 +// (and perhaps others) while implementing templated constructors.
1.45 +
1.46 +namespace boost {
1.47 +
1.48 +template<class T>
1.49 +struct pfto_wrapper {
1.50 + const T & t;
1.51 + operator const T & (){
1.52 + return t;
1.53 + }
1.54 + pfto_wrapper (const T & rhs) : t(rhs) {}
1.55 +};
1.56 +
1.57 +template<class T>
1.58 +pfto_wrapper<T> make_pfto_wrapper(const T & t, BOOST_PFTO int){
1.59 + return pfto_wrapper<T>(t);
1.60 +}
1.61 +
1.62 +template<class T>
1.63 +pfto_wrapper<T> make_pfto_wrapper(const pfto_wrapper<T> & t, int){
1.64 + return t;
1.65 +}
1.66 +
1.67 +} // namespace boost
1.68 +
1.69 +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1.70 + #define BOOST_PFTO_WRAPPER(T) boost::pfto_wrapper<T>
1.71 + #define BOOST_MAKE_PFTO_WRAPPER(t) boost::make_pfto_wrapper(t, 0)
1.72 +#else
1.73 + #define BOOST_PFTO_WRAPPER(T) T
1.74 + #define BOOST_MAKE_PFTO_WRAPPER(t) t
1.75 +#endif
1.76 +
1.77 +#endif // BOOST_PFTO_HPP