Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/static_assert/static_assert_test_fail_7.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 887 bytes
Line 
1//  (C) Copyright John Maddock 2000.
2//  Use, modification and distribution are subject to the
3//  Boost Software License, Version 1.0. (See accompanying file
4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6//  See http://www.boost.org for most recent version including documentation.
7
8#include <climits>
9#include <boost/limits.hpp>
10#include <boost/static_assert.hpp>
11
12template <class UnsignedInt>
13class myclass
14{
15private:
16   BOOST_STATIC_ASSERT(sizeof(UnsignedInt) * CHAR_BIT >= 16);
17   BOOST_STATIC_ASSERT(std::numeric_limits<UnsignedInt>::is_specialized
18                        && std::numeric_limits<UnsignedInt>::is_integer
19                        && !std::numeric_limits<UnsignedInt>::is_signed);
20public:
21   /* details here */
22};
23
24myclass<int>           m2; // this should fail
25myclass<unsigned char> m3; // and so should this
26
27int main()
28{
29   return 0;
30}
31
Note: See TracBrowser for help on using the repository browser.