|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58096 - in trunk: boost/uuid libs/uuid libs/uuid/test
From: atompkins_at_[hidden]
Date: 2009-12-02 08:44:09
Author: atompkins
Date: 2009-12-02 08:44:08 EST (Wed, 02 Dec 2009)
New Revision: 58096
URL: http://svn.boost.org/trac/boost/changeset/58096
Log:
Removed BOOST_STATIC_ASSERT, replaced with a static method
Text files modified:
trunk/boost/uuid/uuid.hpp | 13 +++++++++----
trunk/libs/uuid/test/test_uuid.cpp | 2 +-
trunk/libs/uuid/uuid.html | 4 ++--
3 files changed, 12 insertions(+), 7 deletions(-)
Modified: trunk/boost/uuid/uuid.hpp
==============================================================================
--- trunk/boost/uuid/uuid.hpp (original)
+++ trunk/boost/uuid/uuid.hpp 2009-12-02 08:44:08 EST (Wed, 02 Dec 2009)
@@ -27,6 +27,7 @@
// 19 Mar 2009 - changed to a POD, reorganized files
// 28 Nov 2009 - disabled deprecated warnings for MSVC
// 30 Nov 2009 - used BOOST_STATIC_CONSTANT
+// 02 Dec 2009 - removed BOOST_STATIC_CONSTANT - not all compilers like it
#ifndef BOOST_UUID_HPP
#define BOOST_UUID_HPP
@@ -65,7 +66,11 @@
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
- BOOST_STATIC_CONSTANT(size_type, static_size = 16);
+ // This does not work on some compilers
+ // They seem to want the variable definec in
+ // a cpp file
+ //BOOST_STATIC_CONSTANT(size_type, static_size = 16);
+ static size_type static_size() { return 16; }
public:
iterator begin() { return data; } /* throw() */
@@ -73,13 +78,13 @@
iterator end() { return data+size(); } /* throw() */
const_iterator end() const { return data+size(); } /* throw() */
- size_type size() const { return static_size; } /* throw() */
+ size_type size() const { return static_size(); } /* throw() */
bool is_nil() const /* throw() */
{
// could be more efficient by stopping at the firt
// non zero
- return (std::count(begin(), end(), 0) == static_size);
+ return (std::count(begin(), end(), 0) == static_size());
}
enum variant_type
@@ -143,7 +148,7 @@
public:
// or should it be array<uint8_t, 16>
- uint8_t data[static_size];
+ uint8_t data[16];
};
inline bool operator==(uuid const& lhs, uuid const& rhs) /* throw() */
Modified: trunk/libs/uuid/test/test_uuid.cpp
==============================================================================
--- trunk/libs/uuid/test/test_uuid.cpp (original)
+++ trunk/libs/uuid/test/test_uuid.cpp 2009-12-02 08:44:08 EST (Wed, 02 Dec 2009)
@@ -24,7 +24,7 @@
using boost::test_tools::output_test_stream;
// uuid::static_size
- BOOST_CHECK_EQUAL(uuid::static_size, 16U);
+ BOOST_CHECK_EQUAL(uuid::static_size(), 16U);
{ // uuid::operator=()
uuid u1 = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}};
Modified: trunk/libs/uuid/uuid.html
==============================================================================
--- trunk/libs/uuid/uuid.html (original)
+++ trunk/libs/uuid/uuid.html 2009-12-02 08:44:08 EST (Wed, 02 Dec 2009)
@@ -170,7 +170,7 @@
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
- enum { static_size = 16 };
+ static size_type static_size();
// iteration
iterator begin();
@@ -203,7 +203,7 @@
// Swap function
void swap(uuid& rhs);
- uint8_t data[static_size];
+ uint8_t data[static_size()];
};
// standard operators
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk