Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dnachbaur
Copy link
Contributor

This is part of event-based communication spec from HBPVIS/ZeroEQ#152.

ConstAllocator& operator = ( const ConstAllocator& ) = delete;

uint8_t* getData() final
{ return const_cast< uint8_t* >( _data ); } // internal

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be aware that this is not sufficient to protect the internal buffer. If the allocator is used through it's base class this function is not private. I'm not sure making it throw prevents non const access, without reading all the client code is difficult to say if the compiler is going to pick always the const version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the throw before for the same reasons, but it does not work unfortunately. With the test schema in the unit tests, it passes by code which calls getData() and the compiler prefers the non-const over the const version, hence it passes by here. A delete for this non-const getData() is what one wants here...

@hernando
Copy link

hernando commented May 26, 2016

Besides what we discussed offline about getData and the cosmetic changes about strings +1.

…, ZEROBUF_TYPE_IDENTIFIER()

This is part of event-based communication spec from HBPVIS/ZeroEQ#152.
@hernando hernando merged commit af22a21 into HBPVIS:master May 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants