Compare commits

..

7 Commits

Author SHA1 Message Date
62073f9cf7 Create branch for next serialization release
[SVN r38613]
2007-08-13 03:23:47 +00:00
720fb456d5 This commit was manufactured by cvs2svn to create tag
'Version_1_34_1'.

[SVN r38286]
2007-07-24 19:28:14 +00:00
2fa11699bf Added links to PDF docs.
[SVN r37653]
2007-05-09 17:20:56 +00:00
69dbf6f12d Remove obsolete Boost.Build v1 files.
[SVN r35880]
2006-11-06 17:10:46 +00:00
66dd3d2595 Added trivial docs change, based on user suggestion, and brought example code into synch.
[SVN r34874]
2006-08-11 18:14:13 +00:00
7a0a3fbf32 Added license info.
[SVN r34585]
2006-07-17 10:49:22 +00:00
c5de8ff789 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r33417]
2006-03-21 02:26:31 +00:00
2 changed files with 13 additions and 31 deletions

View File

@ -15,12 +15,12 @@
[last-revision $Date$]
]
This manual is also available in
[@http:svn.boost.org/svn/boost/sandbox/pdf/static_assert/release/static_assert.pdf
printer friendly PDF format].
[section:intro Overview and Tutorial]
This documentation is
[@http://boost-consulting.com/vault/index.php?action=downloadfile&filename=boost_static_assert-1.34.pdf&directory=PDF%20Documentation&
also available in printer-friendly PDF format].
The header `<boost/static_assert.hpp>` supplies a single macro `BOOST_STATIC_ASSERT(x)`,
which generates a compile time error message if the integral-constant-expression `x`
is not true. In other words it is the compile time equivalent of the assert macro;
@ -98,17 +98,12 @@ the user that the template is being misused.
#include <boost/type_traits.hpp>
template <class RandomAccessIterator >
RandomAccessIterator foo(RandomAccessIterator from,
RandomAccessIterator to)
RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator to)
{
// this template can only be used with
// random access iterators...
typedef typename std::iterator_traits<
RandomAccessIterator >::iterator_category cat;
BOOST_STATIC_ASSERT(
(boost::is_convertible<
cat,
const std::random_access_iterator_tag&>::value));
typedef typename std::iterator_traits< RandomAccessIterator >::iterator_category cat;
BOOST_STATIC_ASSERT((boost::is_convertible<cat, const std::random_access_iterator_tag&>::value));
//
// detail goes here...
return from;
@ -228,3 +223,4 @@ working at namespace, function, and class scope outweighed the ugliness of a mac
[endsect]

View File

@ -28,20 +28,6 @@
# define BOOST_SA_GCC_WORKAROUND
#endif
//
// If the compiler issues warnings about old C style casts,
// then enable this:
//
#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)))
# define BOOST_STATIC_ASSERT_BOOL_CAST( x ) ((x) == 0 ? false : true)
#else
# define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x)
#endif
#ifdef BOOST_HAS_STATIC_ASSERT
# define BOOST_STATIC_ASSERT( B ) static_assert(B, #B)
#else
namespace boost{
// HP aCC cannot deal with missing names for template value parameters
@ -88,14 +74,14 @@ template<int x> struct static_assert_test{};
#elif defined(BOOST_MSVC)
#define BOOST_STATIC_ASSERT( B ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST ( B ) >)>\
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< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >::value ]
[ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ]
#elif defined(__sgi)
// special version for SGI MIPSpro compiler
#define BOOST_STATIC_ASSERT( B ) \
@ -110,12 +96,12 @@ template<int x> struct static_assert_test{};
#define BOOST_STATIC_ASSERT( B ) \
BOOST_STATIC_CONSTANT(int, \
BOOST_JOIN(boost_static_assert_test_, __LINE__) = \
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >) )
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< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
#endif
@ -125,7 +111,7 @@ template<int x> struct static_assert_test{};
enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \
= sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) }
#endif
#endif // ndef BOOST_HAS_STATIC_ASSERT
#endif // BOOST_STATIC_ASSERT_HPP