forked from boostorg/static_assert
Compare commits
2 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
b89281496e | |||
9074163b1e |
16
Jamfile
16
Jamfile
@ -1,16 +0,0 @@
|
|||||||
subproject libs/static_assert ;
|
|
||||||
|
|
||||||
|
|
||||||
unit-test static_assert_test : static_assert_test.cpp
|
|
||||||
: <sysinclude>$(BOOST_ROOT) : ;
|
|
||||||
|
|
||||||
unit-test static_assert_example_1 : static_assert_example_1.cpp
|
|
||||||
: <sysinclude>$(BOOST_ROOT) : ;
|
|
||||||
|
|
||||||
unit-test static_assert_example_2 : static_assert_example_2.cpp
|
|
||||||
: <sysinclude>$(BOOST_ROOT) : ;
|
|
||||||
|
|
||||||
unit-test static_assert_example_3 : static_assert_example_3.cpp
|
|
||||||
: <sysinclude>$(BOOST_ROOT) : ;
|
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Revision history:
|
Revision history:
|
||||||
02 August 2000
|
02 August 2000
|
||||||
Initial version.
|
Initial version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BOOST_STATIC_ASSERT_HPP
|
#ifndef BOOST_STATIC_ASSERT_HPP
|
||||||
|
@ -131,7 +131,7 @@ argument, we can achieve this using something like this:</p>
|
|||||||
<pre>#include <climits>
|
<pre>#include <climits>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
template <class UnsignedInt>
|
Template <class UnsignedInt>template <class UnsignedInt>
|
||||||
class myclass
|
class myclass
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <cwchar>
|
#include <cwchar>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
#if !defined(WCHAR_MIN)
|
#if defined(__BORLANDC__) && !defined(WCHAR_MIN)
|
||||||
#define WCHAR_MIN 0
|
#define WCHAR_MIN 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -29,4 +29,3 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator to)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::deque<int> d;
|
std::deque<int> d;
|
||||||
std::list<int> l;
|
std::list<int> l;
|
||||||
foo(d.begin(), d.end()); // OK
|
foo(d.begin(), d.end()); // OK
|
||||||
//foo(l.begin(), l.end()); // error
|
//foo(l.begin(), l.end()); // error
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ struct Bob
|
|||||||
char c;
|
char c;
|
||||||
int f()
|
int f()
|
||||||
{
|
{
|
||||||
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 // broken sizeof in VC6
|
#ifndef BOOST_MSVC // broken sizeof in VC6
|
||||||
BOOST_STATIC_ASSERT(sizeof(x) == 4);
|
BOOST_STATIC_ASSERT(sizeof(x) == 4);
|
||||||
BOOST_STATIC_ASSERT(sizeof(c) == 1);
|
BOOST_STATIC_ASSERT(sizeof(c) == 1);
|
||||||
BOOST_STATIC_ASSERT((sizeof(x) == sizeof(c))); // should not compile
|
BOOST_STATIC_ASSERT((sizeof(x) == sizeof(c))); // should not compile
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/type_traits.hpp>
|
#include <boost/type_traits.hpp>
|
||||||
|
|
||||||
template <class RandomAccessIterator >
|
template <class RandonAccessIterator >
|
||||||
RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator)
|
RandonAccessIterator foo(RandonAccessIterator from, RandonAccessIterator to)
|
||||||
{
|
{
|
||||||
// this template can only be used with
|
// this template can only be used with
|
||||||
// random access iterators...
|
// random access iterators...
|
||||||
typedef typename std::iterator_traits< RandomAccessIterator >::iterator_category cat;
|
typedef typename std::iterator_traits< RandonAccessIterator >::iterator_category cat;
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<cat*, std::random_access_iterator_tag*>::value));
|
BOOST_STATIC_ASSERT((boost::is_convertible<cat*, std::random_access_iterator_tag*>::value));
|
||||||
//
|
//
|
||||||
// detail goes here...
|
// detail goes here...
|
||||||
@ -26,11 +26,11 @@ RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::deque<int> d;
|
std::deque<int> d;
|
||||||
std::list<int> l;
|
std::list<int> l;
|
||||||
foo(d.begin(), d.end()); // OK
|
foo(d.begin(), d.end()); // OK
|
||||||
foo(l.begin(), l.end()); // error
|
foo(l.begin(), l.end()); // error
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user