buffer_t const assignment fails

This commit is contained in:
Joe Thornber 2013-01-23 13:12:17 +00:00
parent 5776ba114c
commit c2ab5390cb
2 changed files with 2 additions and 1 deletions

View File

@ -44,6 +44,7 @@ namespace persistent_data {
class buffer : private boost::noncopyable { class buffer : private boost::noncopyable {
public: public:
typedef boost::shared_ptr<buffer> ptr; typedef boost::shared_ptr<buffer> ptr;
typedef boost::shared_ptr<buffer const> const_ptr;
unsigned char &operator[](unsigned index) { unsigned char &operator[](unsigned index) {
check_index(index); check_index(index);

View File

@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(buffer_8_a_8_access)
BOOST_AUTO_TEST_CASE(buffer_8_a_8_const_access) BOOST_AUTO_TEST_CASE(buffer_8_a_8_const_access)
{ {
uint32_t const sz = 8, align = 8; uint32_t const sz = 8, align = 8;
buffer<sz, align>::ptr const b = create_buffer<sz, align>(); buffer<sz, align>::const_ptr b = create_buffer<sz, align>();
(*b)[0] = 0; // Compile time error accessing read-only location (*b)[0] = 0; // Compile time error accessing read-only location
} }