|
by: James Mastro |
last post by:
This one has been driving me nuts all day. In a function I have the
following:
std::list< boost::shared_ptr<MyObject> > * objectList;
When debugging my code, the debugger (gdb) dies upon entering the
function with this in it. It says "The Debugger has exited due to signal
11 (SIGSEGV).The Debugger has exited due to signal 11...
|
by: yinglcs |
last post by:
I am reading the Boost scoped_ptr library, and I wonder what is the
advantage of using that.
Here is an example from Boost.org web site:
#include <boost/scoped_ptr.hpp>
#include <iostream>
struct Shoe { ~Shoe() { std::cout << "Buckle my shoe\n"; } };
|
by: aaronfude |
last post by:
Hi,
Please consider the following class (it's not really my class, but it's
a good example for my question):
class Vector {
int myN;
double *myX;
Vector(int n) : myN(n), myX(new double) { }
double &operator()(int i) { return myX; }
|
by: Rafał Maj Raf256 |
last post by:
How can I manually (other then
http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html)
create a shared, and a weak pointer to "this"?
Of course I dont want the shared / weak pointer to cause object to be
deleted when shared/weak ptr will go out of scope.
--
Wymiana starych układów... na nowe układy - prawie jak walka z...
|
by: Protoman |
last post by:
OK, this code compiles, links, and executes, but, how do I setup, like,
a spinlock to query the DataBase object's status to let the SmrtPtr
know that the object's been deleted?:
#pragma once
class SmrtPtrDB
{
public:
SmrtPtrDB():num(0){}
|
|
by: ank |
last post by:
Hi, all.
I've come to think of the idea of
automatic initialization/deinitialization of
non-local reference count pointer.
I've made an assumption that the user of the pointer
only read pointer after acquire the reference (increment the ref count)
and when finished using it, the user will release the ref count.
|
by: happyvalley |
last post by:
Hi,
basically, the test function get a char pointer, and assigned a string
to it. then the string is passed back by the call-by-reference
mechanism. in test(), I reallocate some memory for the pointer, the
size is not fixed.
I remember, all new statement should be followed by a delete statement,
is there some memory leak here?
|
by: Dennis Jones |
last post by:
Hello,
I would like to know if there is a known pattern for creating a map of
reference-counted objects, such that when the last reference to an object is
deleted, the element referring to that object is removed from the map.
Since Boost's shared_ptr class allows a custom deleter to be specified, I
was thinking about something like this:
|
by: phlip |
last post by:
Nick Keighley wrote:
CC'd to the correct newsgroup.
Yes, the destructor of the shared pointer will delete the object. Then its
former address will convert to a reference. At some point - possibly the
conversion - Undefined Behavior will begin. And then when whoever collects the
reference uses it, Undefined Behavior will continue.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
|