This commit was generated by cvs2svn to compensate for changes in r4,

which included commits to RCS files with non-trunk default branches.


[SVN r7621]
This commit is contained in:
Beman Dawes 2000-07-07 16:04:40 +00:00
commit fca67c7788
2 changed files with 258 additions and 0 deletions

96
.gitattributes vendored Normal file
View File

@ -0,0 +1,96 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
*.cgi text svneol=native#text/plain
*.cmd text svneol=native#text/plain
*.js text svneol=native#text/javascript
*.php text svneol=native#text/x-php
*.pl text svneol=native#text/x-perl
*.pm text svneol=native#text/x-perl
*.py text svneol=native#text/x-python
*.sh eol=lf svneol=LF#text/x-sh
configure eol=lf svneol=LF#text/x-sh
# Image formats
*.bmp binary svneol=unset#image/bmp
*.gif binary svneol=unset#image/gif
*.ico binary svneol=unset#image/ico
*.jpeg binary svneol=unset#image/jpeg
*.jpg binary svneol=unset#image/jpeg
*.png binary svneol=unset#image/png
*.tif binary svneol=unset#image/tiff
*.tiff binary svneol=unset#image/tiff
*.svg text svneol=native#image/svg%2Bxml
# Data formats
*.pdf binary svneol=unset#application/pdf
*.avi binary svneol=unset#video/avi
*.doc binary svneol=unset#application/msword
*.dsp text svneol=crlf#text/plain
*.dsw text svneol=crlf#text/plain
*.eps binary svneol=unset#application/postscript
*.gz binary svneol=unset#application/gzip
*.mov binary svneol=unset#video/quicktime
*.mp3 binary svneol=unset#audio/mpeg
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
*.ps binary svneol=unset#application/postscript
*.psd binary svneol=unset#application/photoshop
*.rdf binary svneol=unset#text/rdf
*.rss text svneol=unset#text/xml
*.rtf binary svneol=unset#text/rtf
*.sln text svneol=native#text/plain
*.swf binary svneol=unset#application/x-shockwave-flash
*.tgz binary svneol=unset#application/gzip
*.vcproj text svneol=native#text/xml
*.vcxproj text svneol=native#text/xml
*.vsprops text svneol=native#text/xml
*.wav binary svneol=unset#audio/wav
*.xls binary svneol=unset#application/vnd.ms-excel
*.zip binary svneol=unset#application/zip
# Text formats
.htaccess text svneol=native#text/plain
*.bbk text svneol=native#text/xml
*.cmake text svneol=native#text/plain
*.css text svneol=native#text/css
*.dtd text svneol=native#text/xml
*.htm text svneol=native#text/html
*.html text svneol=native#text/html
*.ini text svneol=native#text/plain
*.log text svneol=native#text/plain
*.mak text svneol=native#text/plain
*.qbk text svneol=native#text/plain
*.rst text svneol=native#text/plain
*.sql text svneol=native#text/x-sql
*.txt text svneol=native#text/plain
*.xhtml text svneol=native#text/xhtml%2Bxml
*.xml text svneol=native#text/xml
*.xsd text svneol=native#text/xml
*.xsl text svneol=native#text/xml
*.xslt text svneol=native#text/xml
*.xul text svneol=native#text/xul
*.yml text svneol=native#text/plain
boost-no-inspect text svneol=native#text/plain
CHANGES text svneol=native#text/plain
COPYING text svneol=native#text/plain
INSTALL text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamroot text svneol=native#text/plain
Jamfile.v2 text svneol=native#text/plain
Jamrules text svneol=native#text/plain
Makefile* text svneol=native#text/plain
README text svneol=native#text/plain
TODO text svneol=native#text/plain
# Code formats
*.c text svneol=native#text/plain
*.cpp text svneol=native#text/plain
*.h text svneol=native#text/plain
*.hpp text svneol=native#text/plain
*.ipp text svneol=native#text/plain
*.tpp text svneol=native#text/plain
*.jam text svneol=native#text/plain
*.java text svneol=native#text/plain

162
include/boost/cast.hpp Normal file
View File

@ -0,0 +1,162 @@
// boost cast.hpp header file ----------------------------------------------//
// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright
// notice appears in all copies. This software is provided "as is" without
// express or implied warranty, and with no claim as to its suitability for
// any purpose.
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams)
// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes)
// 27 Jun 00 More MSVC6 workarounds
// 15 Jun 00 Add workarounds for MSVC6
// 2 Feb 00 Remove bad_numeric_cast ";" syntax error (Doncho Angelov)
// 26 Jan 00 Add missing throw() to bad_numeric_cast::what(0 (Adam Levar)
// 29 Dec 99 Change using declarations so usages in other namespaces work
// correctly (Dave Abrahams)
// 23 Sep 99 Change polymorphic_downcast assert to also detect M.I. errors
// as suggested Darin Adler and improved by Valentin Bonnard.
// 2 Sep 99 Remove controversial asserts, simplify, rename.
// 30 Aug 99 Move to cast.hpp, replace value_cast with numeric_cast,
// place in nested namespace.
// 3 Aug 99 Initial version
#ifndef BOOST_CAST_HPP
#define BOOST_CAST_HPP
# include <boost/config.hpp>
# include <cassert>
# include <typeinfo>
# include <limits>
// It has been demonstrated numerous times that MSVC 6.0 fails silently at link
// time if you use a template function which has template parameters that don't
// appear in the function's argument list.
//
// TODO: Add this to config.hpp?
# if defined(BOOST_MSVC) && BOOST_MSVC <= 1200 // 1200 = VC6
# define BOOST_EXPLICIT_DEFAULT_TARGET , ::boost::detail::type_wrapper<Target>* = 0
# define BOOST_EXPLICIT_TARGET ,::boost::detail::type_wrapper<Target>*
# else
# define BOOST_EXPLICIT_DEFAULT_TARGET
# define BOOST_EXPLICIT_TARGET
# endif
namespace boost
{
namespace detail {
template <class T> struct type_wrapper {};
}
#if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1200) // 1200 = VC6
namespace cast
{
#endif
// See the documentation for descriptions of how to choose between
// static_cast<>, dynamic_cast<>, polymorphic_cast<>. and down_cast<>
// polymorphic_cast --------------------------------------------------------//
// Runtime checked polymorphic downcasts and crosscasts.
// Suggested in The C++ Programming Language, 3rd Ed, Bjarne Stroustrup,
// section 15.8 exercise 1, page 425.
template <class Target, class Source>
inline Target polymorphic_cast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
{
Target tmp = dynamic_cast<Target>(x);
if ( tmp == 0 ) throw std::bad_cast();
return tmp;
}
// polymorphic_downcast ----------------------------------------------------//
// assert() checked polymorphic downcast. Crosscasts prohibited.
// WARNING: Because this cast uses assert(), it violates the One Definition
// Rule if NDEBUG is inconsistently defined across translation units.
// Contributed by Dave Abrahams
template <class Target, class Source>
inline Target polymorphic_downcast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
{
assert( dynamic_cast<Target>(x) == x ); // detect logic error
return static_cast<Target>(x);
}
// implicit_cast -----------------------------------------------------------//
//
// Removed due to uncertain purpose. Use either numeric_cast (see below)
// or static_cast according to the need.
// numeric_cast and related exception --------------------------------------//
// Contributed by Kevlin Henney
// bad_numeric_cast --------------------------------------------------------//
// exception used to indicate runtime numeric_cast failure
class bad_numeric_cast : public std::bad_cast
{
public:
// constructors, destructors and assignment operator defaulted
// function inlined for brevity and consistency with rest of library
virtual const char *what() const throw()
{
return "bad numeric cast: loss of range in numeric_cast";
}
};
// numeric_cast ------------------------------------------------------------//
template<typename Target, typename Source>
inline Target numeric_cast(Source arg BOOST_EXPLICIT_DEFAULT_TARGET)
{
// typedefs abbreviating respective trait classes
typedef std::numeric_limits<Source> arg_traits;
typedef std::numeric_limits<Target> result_traits;
// typedefs that act as compile time assertions
// (to be replaced by boost compile time assertions
// as and when they become available and are stable)
typedef bool argument_must_be_numeric[arg_traits::is_specialized];
typedef bool result_must_be_numeric[result_traits::is_specialized];
if( (arg < 0 && !result_traits::is_signed) || // loss of negative range
(arg_traits::is_signed &&
arg < result_traits::min()) || // underflow
arg > result_traits::max() ) // overflow
throw bad_numeric_cast();
return static_cast<Target>(arg);
}
// Visual C++ workarounds --------------------------------------------------//
# if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1200) // 1200 = VC6
} // namespace cast
using ::boost::cast::polymorphic_cast;
using ::boost::cast::polymorphic_downcast;
using ::boost::cast::bad_numeric_cast;
using ::boost::cast::numeric_cast;
# else
namespace cast {
using ::boost::polymorphic_cast;
using ::boost::polymorphic_downcast;
using ::boost::bad_numeric_cast;
using ::boost::numeric_cast;
}
# endif
# undef BOOST_EXPLICIT_DEFAULT_TARGET
# undef BOOST_EXPLICIT_TARGET
} // namespace boost
#endif // BOOST_CAST_HPP