Compare commits

..

50 Commits

Author SHA1 Message Date
0e93faa340 This commit was manufactured by cvs2svn to create branch
'thread_rewrite'.

[SVN r30953]
2005-09-13 14:20:32 +00:00
098770b91d Improved local documentation build.
[SVN r30479]
2005-08-05 11:44:32 +00:00
1b9f71f4dd Renamed over long file name.
[SVN r30007]
2005-07-12 12:55:27 +00:00
f7531de553 Add custom static_assert for CodeWarrior <= 8. Which works in all contexts, specifically it works inside tempalte function contexts which the standard one doesn't. This makes all tests pass for this compiler for the first time.
[SVN r28941]
2005-05-15 22:40:40 +00:00
11be1f5a93 Add static_assert test to test use inside template functions. Currently this test fails on CW-8.x compilers.
[SVN r28904]
2005-05-14 18:44:59 +00:00
3959c96e26 Fix up docs to point to new BoostBook versions.
[SVN r28460]
2005-04-24 12:01:56 +00:00
178eed53c2 Fixed library information in docs.
Updated examples to match new docs.


[SVN r28289]
2005-04-17 10:45:13 +00:00
81625fade8 Added new style docs
[SVN r28280]
2005-04-16 16:33:02 +00:00
811af44dd5 Added section describing problems with non-dependent static asserts in templates.
Added table of contents.


[SVN r25725]
2004-10-14 11:19:53 +00:00
2cf2951f97 c++boost.gif -> boost.png replacement
[SVN r25573]
2004-10-05 15:45:52 +00:00
f60bc26f84 Improved gcc 3.3 and 3.4 error messages.
[SVN r25413]
2004-09-26 10:24:34 +00:00
f0969644d0 Fixed doc typo.
[SVN r23427]
2004-07-10 12:36:22 +00:00
68545773d5 Changed tests to guarantee portability
[SVN r22245]
2004-02-12 11:29:47 +00:00
328b4fee16 MWCW 8.3 no longer needs the enum version. This fixes a problem in Spirit, because of two header files both having a static assert at the same line.
[SVN r21364]
2003-12-21 16:34:52 +00:00
21ab9ce12a stripped tabs
[SVN r21012]
2003-11-30 13:08:35 +00:00
0e39de168b Changed email address to john@johnmaddock.co.uk
[SVN r20472]
2003-10-24 11:13:42 +00:00
52bc1a8fb7 Added new licence info.
[SVN r20254]
2003-10-04 11:29:20 +00:00
0566bafd1d Changed licence to new Boost licnece
[SVN r20241]
2003-10-02 11:53:35 +00:00
a2c78d51be Updated licence
[SVN r20237]
2003-10-01 10:28:17 +00:00
d06c7261fc Add V2 Jamfile
[SVN r20224]
2003-09-30 08:05:42 +00:00
5e7c100b55 Use the import rule
[SVN r19968]
2003-09-08 17:38:49 +00:00
c26dde8e6e Force early instantiation so test works with delayed instantiation compilers (Greg Comeau)
[SVN r19378]
2003-07-31 00:11:24 +00:00
19e8840ad7 Added __COUNTER__ based version for VC7 and later.
[SVN r19043]
2003-07-11 11:01:55 +00:00
dd969b13ab Stop running example1 in the tests: it's intentionally non-portable.
[SVN r18823]
2003-06-17 10:50:02 +00:00
5ea5535e1a Added copyright
[SVN r18524]
2003-05-24 11:11:11 +00:00
64973e2132 add special version for SGI MIPSpro compiler
[SVN r18173]
2003-04-03 22:33:23 +00:00
02c6fb40a6 Modified Jamfile to use testing.jam
[SVN r16868]
2003-01-11 11:52:19 +00:00
5ea88d2e64 add or update See www.boost.org comments
[SVN r16708]
2002-12-27 16:51:53 +00:00
1029ee8032 Intel C++ fix
[SVN r15351]
2002-09-16 01:19:05 +00:00
f2732e699f init commit
[SVN r14977]
2002-08-19 23:29:18 +00:00
9d3c2ed75f Fix unversioned VC++ checks
[SVN r14436]
2002-07-13 12:26:19 +00:00
38b5799e33 respect <sysinclude>
[SVN r13995]
2002-05-21 16:24:07 +00:00
22bb032a79 fix typo in template parameter name
[SVN r13043]
2002-03-03 10:16:50 +00:00
f2725b11af Fixed typo
[SVN r12473]
2002-01-24 12:37:38 +00:00
3ab5f7708e Stripped tabs from source
[SVN r12351]
2002-01-19 12:38:14 +00:00
07628a01a7 Fixed unused variables that show up as warnings when doing regression
tests.


[SVN r11241]
2001-09-24 23:21:16 +00:00
10425f4864 commit of split-config, including any changes required to existing libraries (mainly regex).
[SVN r11138]
2001-09-18 11:13:39 +00:00
3bfec69135 Added Jamfile
[SVN r11074]
2001-09-08 12:07:08 +00:00
90ff3895af Fixed WCHAR_MIN issues
[SVN r11073]
2001-09-08 12:06:21 +00:00
b776265f02 Tweeked so that test fails under VC6 (it should due to a compiler bug).
[SVN r10612]
2001-07-14 11:18:31 +00:00
a674ac4176 Added comment about lack of static_cast
[SVN r10243]
2001-05-30 11:31:15 +00:00
2b67e5a182 cast integral constant expression to bool to fix some compiler warnings and some compiler bugs.
[SVN r10230]
2001-05-26 10:58:43 +00:00
8b37ed2072 add HP aCC workarounds
[SVN r10025]
2001-05-05 20:26:38 +00:00
a947d4039a updated url's
[SVN r9993]
2001-04-30 11:28:03 +00:00
976f1c78a5 Change all eGroups references to YahooGroups
[SVN r9979]
2001-04-25 00:24:50 +00:00
5d68bc2fd8 fixed typo
[SVN r9836]
2001-04-19 10:53:11 +00:00
362a22e3a7 added integral constant expression links, added tentative fix to is_function_test for older EDG based compilers
[SVN r9833]
2001-04-18 11:28:53 +00:00
1cd7ee8570 Added boost-wide <limits> woraround
[SVN r9688]
2001-04-01 11:59:18 +00:00
cb09a717dd tentative fix for MWCW
[SVN r8914]
2001-02-04 12:59:54 +00:00
e26b873c29 Fix for EDG based compilers
[SVN r8888]
2001-02-03 11:32:24 +00:00
2 changed files with 59 additions and 68 deletions

View File

@ -1,21 +1,21 @@
// (C) Copyright John Maddock 2000.
// 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.
// 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)
// See http://www.boost.org for most recent version including documentation.
// See http://www.boost.org/libs/static_assert for documentation.
/*
Revision history:
02 August 2000
Initial version.
02 August 2000
Initial version.
*/
#ifndef BOOST_STATIC_ASSERT_HPP
#define BOOST_STATIC_ASSERT_HPP
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#ifdef __BORLANDC__
//
@ -23,13 +23,20 @@
#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS
#endif
#if defined(__GNUC__) && (__GNUC__ == 3) && ((__GNUC_MINOR__ == 3) || (__GNUC_MINOR__ == 4))
// gcc 3.3 and 3.4 don't produce good error messages with the default version:
# define BOOST_SA_GCC_WORKAROUND
#endif
namespace boost{
template <bool> struct STATIC_ASSERTION_FAILURE;
// HP aCC cannot deal with missing names for template value parameters
template <bool x> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true>{};
template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
template<int> struct static_assert_test{};
// HP aCC cannot deal with missing names for template value parameters
template<int x> struct static_assert_test{};
}
@ -51,39 +58,61 @@ template<int> struct static_assert_test{};
// an eye catching error message. The result of the sizeof expression is either
// used as an enum initialiser, or as a template argument depending which version
// is in use...
// Note that the argument to the assert is explicitly cast to bool using old-
// style casts: too many compilers currently have problems with static_cast
// when used inside integral constant expressions.
//
#if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS) && !defined(__MWERKS__)
#ifndef BOOST_MSVC
#define BOOST_STATIC_ASSERT( B ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< ( B ) >)>\
BOOST_ASSERT_JOIN(boost_static_assert_typedef_, __LINE__)
#else
#if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS)
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
// __LINE__ macro broken when -ZI is used see Q199057
// fortunately MSVC ignores duplicate typedef's.
#define BOOST_STATIC_ASSERT( B ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< ( B ) >)\
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)\
> boost_static_assert_typedef_
#elif defined(BOOST_MSVC)
#define BOOST_STATIC_ASSERT( B ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__)
#elif defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND)
// agurt 15/sep/02: a special care is needed to force Intel C++ issue an error
// instead of warning in case of failure
# define BOOST_STATIC_ASSERT( B ) \
typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \
[ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ]
#elif defined(__sgi)
// special version for SGI MIPSpro compiler
#define BOOST_STATIC_ASSERT( B ) \
BOOST_STATIC_CONSTANT(bool, \
BOOST_JOIN(boost_static_assert_test_, __LINE__) = ( B )); \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< \
BOOST_JOIN(boost_static_assert_test_, __LINE__) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
#elif BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
// special version for CodeWarrior <= 8.x
#define BOOST_STATIC_ASSERT( B ) \
BOOST_STATIC_CONSTANT(int, \
BOOST_JOIN(boost_static_assert_test_, __LINE__) = \
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) )
#else
// generic version
#define BOOST_STATIC_ASSERT( B ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
#endif
#else
// alternative enum based implementation:
#define BOOST_STATIC_ASSERT( B ) \
enum { BOOST_ASSERT_JOIN(boost_static_assert_enum_, __LINE__) \
= sizeof(::boost::STATIC_ASSERTION_FAILURE< ( B ) >) }
enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \
= sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) }
#endif
//
// The following piece of macro magic joins the two
// arguments together, even when one of the arguments is
// itself a macro (see 16.3.1 in C++ standard). The key
// is that macro expantion of macro arguments does not
// occur in BOOST_DO_ASSERT_JOIN but does in BOOST_ASSERT_JOIN
// provided it is called from within another macro.
#define BOOST_ASSERT_JOIN( X, Y ) BOOST_DO_ASSERT_JOIN( X, Y )
#define BOOST_DO_ASSERT_JOIN( X, Y ) X##Y
#endif // BOOST_STATIC_ASSERT_HPP

View File

@ -1,38 +0,0 @@
// (C) Copyright John Maddock 2000.
// 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.
#include <iterator>
#include <list>
#include <deque>
#include <boost/static_assert.hpp>
#include <boost/type_traits.hpp>
template <class RandonAccessIterator >
RandonAccessIterator foo(RandonAccessIterator from, RandonAccessIterator to)
{
// this template can only be used with
// random access iterators...
typedef typename std::iterator_traits< RandonAccessIterator >::iterator_category cat;
BOOST_STATIC_ASSERT((boost::is_convertible<cat*, std::random_access_iterator_tag*>::value));
//
// detail goes here...
return from;
}
int main()
{
std::deque<int> d;
std::list<int> l;
foo(d.begin(), d.end()); // OK
foo(l.begin(), l.end()); // error
return 0;
}