forked from boostorg/regex
116 lines
2.5 KiB
C++
116 lines
2.5 KiB
C++
/*
|
|
*
|
|
* Copyright (c) 1998-2004
|
|
* John Maddock
|
|
*
|
|
* Use, modification and distribution are subject to 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)
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* LOCATION: see http://www.boost.org for most recent version.
|
|
* FILE regex_workarounds.cpp
|
|
* VERSION see <boost/version.hpp>
|
|
* DESCRIPTION: Declares Misc workarounds.
|
|
*/
|
|
|
|
#ifndef BOOST_REGEX_WORKAROUND_HPP
|
|
#define BOOST_REGEX_WORKAROUND_HPP
|
|
|
|
|
|
#include <new>
|
|
#include <cstring>
|
|
#include <cstdlib>
|
|
#include <cstddef>
|
|
#include <cassert>
|
|
#include <string>
|
|
#include <stdexcept>
|
|
#include <iterator>
|
|
#include <iosfwd>
|
|
#include <vector>
|
|
#include <map>
|
|
#include <boost/limits.hpp>
|
|
#include <boost/assert.hpp>
|
|
#include <boost/cstdint.hpp>
|
|
#include <boost/throw_exception.hpp>
|
|
#include <boost/scoped_ptr.hpp>
|
|
#include <boost/scoped_array.hpp>
|
|
#include <boost/shared_ptr.hpp>
|
|
#include <boost/mpl/bool_fwd.hpp>
|
|
#ifndef BOOST_NO_STD_LOCALE
|
|
# include <locale>
|
|
#endif
|
|
|
|
namespace boost{ namespace re_detail{
|
|
#ifdef BOOST_NO_STD_DISTANCE
|
|
template <class T>
|
|
std::ptrdiff_t distance(const T& x, const T& y)
|
|
{ return y - x; }
|
|
#else
|
|
using std::distance;
|
|
#endif
|
|
}}
|
|
|
|
|
|
#ifdef BOOST_REGEX_NO_BOOL
|
|
# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>((x) ? true : false)
|
|
#else
|
|
# ifdef BOOST_MSVC
|
|
// warning suppression with VC6:
|
|
# pragma warning(disable: 4800)
|
|
# pragma warning(disable: 4786)
|
|
# endif
|
|
# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>(x)
|
|
#endif
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* Fix broken broken namespace support:
|
|
*
|
|
****************************************************************************/
|
|
|
|
#if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
|
|
|
|
namespace std{
|
|
using ::ptrdiff_t;
|
|
using ::size_t;
|
|
using ::abs;
|
|
using ::memset;
|
|
using ::memcpy;
|
|
}
|
|
|
|
#endif
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* helper functions pointer_construct/pointer_destroy:
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifdef __cplusplus
|
|
namespace boost{ namespace re_detail{
|
|
|
|
#ifdef BOOST_MSVC
|
|
#pragma warning (push)
|
|
#pragma warning (disable : 4100)
|
|
#endif
|
|
|
|
template <class T>
|
|
inline void pointer_destroy(T* p)
|
|
{ p->~T(); (void)p; }
|
|
|
|
#ifdef BOOST_MSVC
|
|
#pragma warning (pop)
|
|
#endif
|
|
|
|
template <class T>
|
|
inline void pointer_construct(T* p, const T& t)
|
|
{ new (p) T(t); }
|
|
|
|
}} // namespaces
|
|
#endif
|
|
|
|
#endif // include guard
|