intrusive_ptr | Proposal for std : :intrusive_ptr
kandi X-RAY | intrusive_ptr Summary
kandi X-RAY | intrusive_ptr Summary
Proposal for std::intrusive_ptr
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of intrusive_ptr
intrusive_ptr Key Features
intrusive_ptr Examples and Code Snippets
Community Discussions
Trending Discussions on intrusive_ptr
QUESTION
I know boost has atomic_shared_ptr which can be used with a shared_ptr.
But is there a way to do something similar with boost::intrusive_ptr ?
i.e. is it possible to share boost::intrusive_ptr across one writer/multiple reader threads WITHOUT using mutexes ?
Back ground :
Unfortunately, my workplace allows only till C++11 (does NOT allow using C++20 yet). std::atomic_store functions in C++11 seems NOT efficient as they use mutexes under the hood(see Notes in mentioned link).
Also due to performance requirements new/delete happening in std/boost shared_ptr for Control Blocks is NOT preferred. Hence the need to use boost::intrusive_ptr.
...ANSWER
Answered 2021-Mar-14 at 14:31It seems this is impossible (at least with C++11) as even boost::atomic_shared_ptr seems to use a boost::detail::spinlock for this. ref : https://github.com/BeamMW/boost-linux/blob/master/boost/smart_ptr/atomic_shared_ptr.hpp
QUESTION
I am about to design and implement a kind of smart pointer toolkit - a set of classes to define various types of smart pointers like unique_ptr, intrusive_ptr, shared_ptr, observing_ptr, tagged_ptr etc. Just to mention I am working in freestanding environment where I have no c++ library available. My intersion is to avoid code duplications, make it follow an elegant design principle. Let me describe my thoughts in there.
Design Considerations: I wanna use variadic CRTP approach to mixin the desired pointer features, the traits. For every feature set there shall be once trait class like:
...ANSWER
Answered 2020-Dec-19 at 18:20You might use variadic template:
QUESTION
I am working on an old source code project which originally was written using MSVC 2008 and Boost 1.42, today I'm trying to port this to MSVC 2017 with Boost 1.73
There are many issues to resolve, one of which is below:
...ANSWER
Answered 2020-Aug-03 at 21:34I have a suspicion the real problem is with binding
which is likely not correctly initialized. There's bound to be more compiler messages about that.
It could be because Boost Bind stopped putting the _1
placeholders in the global namespace by default. You might detect this by adding -DBOOST_BIND_GLOBAL_PLACEHOLDERS
to the compiler flags. However, heed the advice from the code:
QUESTION
Using boost log, I include the thread id in log messages.
...ANSWER
Answered 2020-Apr-01 at 19:17Starting with the example in the documentation makes for a simpler implementation.
QUESTION
Consider the following simple reference counting functions (to be used with boost::intrusive_ptr
):
ANSWER
Answered 2017-Jan-02 at 10:36Incrementing the reference count does not require any synchronization in a correct program, just atomicity.
We pretend that references are owned by threads. A thread may only use a referenced object if the reference counter is at least one, and is guaranteed not to drop to zero while the object is being used, which either means that the thread has incremented the reference counter during its use of the object, or there is another mechanism that ensures this condition is met.
Thus, we assume that the thread incrementing the reference count owns the reference that ensures that it may access the object's reference counter, so no other thread may decrement the reference counter to zero while it is trying to increment the counter. The only thread allowed to drop the initial reference is either the current thread (after incrementing the reference count), or another thread once the current thread has signaled that its shared use of the object (i.e. the "ownership" of the original reference) has ceased -- both of these are visible effects.
On the other hand, decrementing the reference counter requires acquire and release semantics, as the object may be destroyed afterwards.
The CPP Reference's page on std::memory_order
says
Typical use for relaxed memory ordering is incrementing counters, such as the reference counters of std::shared_ptr, since this only requires atomicity, but not ordering or synchronization (note that decrementing the shared_ptr counters requires acquire-release synchronization with the destructor).
QUESTION
I have class A
which holds some data using boost::intrusive_ptr
:
ANSWER
Answered 2018-Dec-13 at 18:35The one solution to your problem I know is to make sure there are no (implicitly) defined constructors or destructors for A
in your header file. The minimal example would look like:
(header file)
QUESTION
I'm trying build the package orocos-toolchain from source.I have already build the ace and tao package inside ACE_wrapper which i downloaded from this page. But after i enter command" catkin_make_isolated --install -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=TAO
" I'm getting below error:
ANSWER
Answered 2018-Apr-09 at 08:13Try to change CorbaType* result;
to const CorbaType* result;
on line 259 of rtt/rtt/transports/corba/CorbaConversion.hpp
QUESTION
I am building a large application using libkml. I am using the cmake port of libkml from here: https://github.com/rashadkm/libkml
I am getting a stranged undefined reference to symbol error even thought the symbol appears to be referenced and defined.
This is the make command:
...ANSWER
Answered 2017-Jun-12 at 15:56It looks like you have an ABI mismatch issue. ABI is "Application Binary Interface", basically the specification for exactly how arguments make it onto the stack (or are put in registers) and various other things like that.
Try making sure your code is compiled with the -std=c++11
(or -std=gnu++11
if you use any GNU extensions) flag. It looks like that's how libkml was compiled. C++11 has a bunch of new features that require an ABI compatibility break with pre-C++11. C++14 and C++1z are less drastic changes, but they may also break ABI compatibility, I'm not sure. In this case though, the demangled symbol is clear, libkml wants at least C++11.
QUESTION
In our codebase we use extensively boost::intrusive_ptr and after moving some headers around I started to get unexpected compilation errors from clang:
...ANSWER
Answered 2017-Apr-18 at 09:12According to this page, ADL support was added in Visual Studio 2008.
With some difficulty, I was able to build EGCS 1.1, the first GCC version that claimed to support namespaces, released in 1997. I tested it by compiling and running the following program:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install intrusive_ptr
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page