- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I keep getting compile errors (in VC8) when trying to use atomic's_internal_reference member (which is public).
When doing this:
[cpp]atomicatomic_int; atomic_int = 5; const int& your_int = atomic_int._internal_reference();[/cpp]
I get this error message:
[cpp]1>d:projectsspikeslibrariestbb21_012ossincludetbb/atomic.h(230) : error C2440: 'static_cast' : cannot convert from 'const int' to 'int &' 1> static_cast and safe_cast to reference can only be used for valid initializations or for lvalue casts between related classes 1> d:projectsspikeslibrariestbb21_012ossincludetbb/atomic.h(229) : while compiling class template member function 'int &tbb::internal::atomic_impl::_internal_reference(void) const' 1> with 1> [ 1> I=int, 1> D=int, 1> Step=1 1> ] 1> d:projectsspikeslibrariestbb21_012ossincludetbb/atomic.h(321) : see reference to class template instantiation 'tbb::internal::atomic_impl' being compiled 1> with 1> [ 1> I=int, 1> D=int, 1> Step=1 1> ][/cpp]
Now I did the following const_cast to solve the issue:
[cpp]File:tbb/atomic.h Line: 230 value_type& _internal_reference() const { return static_cast(const_cast * >(this)->my_value); }[/cpp]
However... I'm not sure if that's the problem at all,
because first of all _internal_reference doesn't look like something
that should be in the public interface at all.
What's the story about this?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this. Method atomic::_internal_reference() is an old method that once was used internally inside TBB. It was never documented. It is no longer used as far as I can tell, and we should remove it from the distribution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the news! It seemed kind of fishy so I was left scratching my head there for a while.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page