diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/exception/to_string_stub.hpp | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/exception/to_string_stub.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/exception/to_string_stub.hpp | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/exception/to_string_stub.hpp b/3rdParty/Boost/src/boost/exception/to_string_stub.hpp new file mode 100644 index 0000000..e41d369 --- /dev/null +++ b/3rdParty/Boost/src/boost/exception/to_string_stub.hpp @@ -0,0 +1,109 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_E788439ED9F011DCB181F25B55D89593 +#define UUID_E788439ED9F011DCB181F25B55D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/exception/to_string.hpp> +#include <boost/exception/detail/object_hex_dump.hpp> +#include <boost/assert.hpp> + +namespace +boost + { + namespace + exception_detail + { + template <bool ToStringAvailable> + struct + to_string_dispatcher + { + template <class T,class Stub> + static + std::string + convert( T const & x, Stub ) + { + return to_string(x); + } + }; + + template <> + struct + to_string_dispatcher<false> + { + template <class T,class Stub> + static + std::string + convert( T const & x, Stub s ) + { + return s(x); + } + + template <class T> + static + std::string + convert( T const & x, std::string s ) + { + return s; + } + + template <class T> + static + std::string + convert( T const & x, char const * s ) + { + BOOST_ASSERT(s!=0); + return s; + } + }; + + namespace + to_string_dispatch + { + template <class T,class Stub> + inline + std::string + dispatch( T const & x, Stub s ) + { + return to_string_dispatcher<has_to_string<T>::value>::convert(x,s); + } + } + + template <class T> + inline + std::string + string_stub_dump( T const & x ) + { + return "[ " + exception_detail::object_hex_dump(x) + " ]"; + } + } + + template <class T> + inline + std::string + to_string_stub( T const & x ) + { + return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump<T>); + } + + template <class T,class Stub> + inline + std::string + to_string_stub( T const & x, Stub s ) + { + return exception_detail::to_string_dispatch::dispatch(x,s); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif |