Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 376 results for
smart-pointers
- Page 1
Re: Smart Pointers
Programming
Software Development
12 Years Ago
by mike_2000_17
Smart
pointers
are not meant to point to dynamic arrays, but to …() + dwHeader, pFile); pFile += jmpSize; Think of iterators like they were
pointers
(but not necessarily actual…
Smart Pointers
Programming
Software Development
12 Years Ago
by triumphost
…took a dive into
smart
pointers
and wasn't sure when I should use them vs. Raw
pointers
. I found out…(pFile, Buffer, dwHeader); pFile = (char*)((DWORD)pFile + jmpSize); //
Smart
ptr.. :S I'm confused.. std::shared_ptr<char[]>…any moment in time where I should use a
Smart
pointer vs. a Raw pointer (Referring to a…
Smart Pointers assignment
Programming
Software Development
16 Years Ago
by c++_student
Can anyone help me with a computer science C++ assignment that i am struggling with? The task is to design and implement a generic reference counted
smart
pointer class library, and use the
smart
pointers
to create a
smart
generic linked list class... any help would be greatly appreciated... Thanks
std::transform to delete smart pointers
Programming
Software Development
17 Years Ago
by sjcomp
Hello, I have a vector of
smart
pointers
and I'd like to NULL
smart
pointers
in reverse order.
Smart
pointers
are done with boost::shared_ptr<…;>, this is the code: [code] // List of
pointers
typedef…
Re: Smart Pointers assignment
Programming
Software Development
16 Years Ago
by Alex Edwards
… of the
smart
pointer properly deallocate memory for the pointer assigned to it (for simplicity assume all
pointers
are created …via new, but if needed you can force your
smart
pointer to accept types … method and a std::size_t size() method for your
smart
pointer class. I'm sure there are plenty of …
Re: std::transform to delete smart pointers
Programming
Software Development
17 Years Ago
by twomers
… &elem ) { elem.reset(); return elem; } }; int main() { // List of
pointers
typedef boost::shared_ptr<int> TSmart; std::vector<…
Re: Pointers and Memory
Programming
Software Development
14 Years Ago
by L7Sqr
Pointers
are interesting (as you've realized). There is no way … you've no way to distinguish between them.
Smart
pointers
can help this to a certain extent but they do … about the design of your code. Either A) decide that
pointers
in containers should *never* be deleted and any scope inserting…
Re: reference counting with smart pointers
Programming
Software Development
14 Years Ago
by thekashyap
None of [URL="http://www.google.com/search?q=reference+counting+with+
smart
+
pointers
"]these[/URL] helped?!
Re: reference counting with smart pointers
Programming
Software Development
14 Years Ago
by drkybelk
look at [url]www.boost.org/doc[/url] there are already good
smart
-
pointers
with ref counting. No need to do the work yourself ;-)
Re: Pointers
Programming
Software Development
14 Years Ago
by mike_2000_17
…TR1, a much safer practice is to use
smart
pointers
(especially the duo shared_ptr and weak_ptr). So most… is what makes them safer, but also makes (
smart
)
pointers
the only candidate for dynamic memory allocation). But now…, considering
smart
pointers
, many people now call
pointers
like "char*" or "…
Re: Pointers and Memory
Programming
Software Development
14 Years Ago
by pseudorandom21
…a
smart
pointer is totally superior for that. But in theory/practice you could copy an array of
pointers
to…... Or you could dynamically allocate and delete them.
smart
pointers
automatically delete the dynamically allocated variable when it goes …out of scope. The standard library has a
smart
pointer type, it's the std::auto_ptr<>…
Re: Pointers and Memory
Programming
Software Development
14 Years Ago
by Lord_Migit
using
pointers
because the vector will eventually reside within a class of … within the vector. Thats all achieved a little easier with
pointers
. Many thanks everyone for your help, managed to sort it… bit in the process. Im still researching
smart
pointers
but they seem more complicated than normal
pointers
, if such a thing is even…
Re: Pointers and Memory
Programming
Software Development
14 Years Ago
by mrnutty
Since they are raw
pointers
you would have to deallocate each pointer manually. If you …]m_vPopulation2 = m_vParentPop2[/i] then you should instead use
smart
pointers
instead of raw
pointers
. If both of the vectors are the same size…
Re: Pointers and Memory
Programming
Software Development
14 Years Ago
by Lord_Migit
… i have no 'new' clause and u can only 'delete'
pointers
that have been created with 'new'. But i do have… lack thereof. On a side note, im now looking into
smart
pointers
. Hadnt heard of them before so will try to learn…
Assignment of pointers to templated class objects using different template arguments
Programming
Software Development
15 Years Ago
by biggie_smalls
Hey all, I got interested in using
smart
pointers
and tried to implement the following solution: [URL="…It's a non intrusive reference counted implementation of a
smart
ptr. And somewhere in the article the assignment operator is…work fine but assignment of a derived class
smart
ptr to a base class
smart
ptr seems to fail: [CODE] ObjVar&…
Indestructible Pointers or Modifiable Const Containers.
Programming
Software Development
12 Years Ago
by triumphost
… whether this is possible or not. Note: I also tried
Smart
Pointers
with a custom deleter but then realize SmartPointers can also…
Re: std::transform to delete smart pointers
Programming
Software Development
17 Years Ago
by sjcomp
Thanks a lot, twomers. Your solution works!
Re: Pointers, references and scope clarification
Programming
Software Development
13 Years Ago
by mike_2000_17
… worried about memory leaks, try making use of reference counted
smart
-
pointers
like `boost::shared_ptr` (or `std::tr1::shared_ptr`).
Re: Pointers inside constructor
Programming
Software Development
13 Years Ago
by deceptikon
… pointer it's safer to use one of C++'s
smart
pointers
instead of pairing up new and delete. [code] // Pointer always…
Re: Pointers inside constructor
Programming
Software Development
13 Years Ago
by mitrious
… pointer it's safer to use one of C++'s
smart
pointers
instead of pairing up new and delete. [code] // Pointer always…
Re: Is it possible to work with out pointers and some OOP in C++?
Programming
Software Development
14 Years Ago
by mike_2000_17
…quot;raw"
pointers
. The use of
smart
pointers
can make this job a lot easier. Raw
pointers
have a classic …the awkward semantics of raw
pointers
, and with that (and the automatic behaviour of
smart
pointers
) you can avoid all…Note, how RAII is based on encapsulation and how
smart
pointers
use abstraction, these concepts of OOP are not evil…
Re: C++ 11, g++, and pointers
Programming
Software Development
10 Years Ago
by mike_2000_17
… And to answer your question, latest versions of GCC support
smart
-
pointers
, along with most C++11 features. There is a complete… added since C++11. So, according to that table,
smart
-
pointers
are supported in GCC since version 4.3, but I… miss out of the great mechanism (such as RAII and
smart
-
pointers
) in C++ that take much of that burden away.…
Re: Use of pointers to hierarchical data structures in C++
Programming
Software Development
14 Years Ago
by mike_2000_17
…value the use of certain techniques like RAII and
Smart
-
Pointers
as essential in any non-trivial programming task. With…to either not use
pointers
at all and store them by value, or use a
smart
pointer. To not store…Set& S) { segments.swap(S.segments); //swap the
pointers
only. return *this; }; boost::shared_ptr< vector<Segment…
Re: pointer and smart pointer address
Programming
Software Development
18 Years Ago
by Ravalon
[QUOTE]How do I get
smart
pointer from pointer address?[/QUOTE] You can't.
Smart
pointers
are
smart
, but regular
pointers
are very dumb. They don… dumb pointer that points to the memory paired with the
smart
pointer. The memory is the same, so you can pass…
Re: pointer and smart pointer address
Programming
Software Development
18 Years Ago
by Ancient Dragon
None of the win32 api functions I'v used take
smart
pointers
as a parameter or pass them back. Why? because they can all be called from other languages which know nothing at all about c++
smart
pointers
.
Re: Linked List of Pointers
Programming
Software Development
16 Years Ago
by kux
…]http://www.onlamp.com/pub/a/onlamp/2006/05/04/
smart
-
pointers
.html?page=1[/url] try reading this... it's kind… also explains the RAII idiom and a large variety of
smart
pointers
. If your STL version doesn't have std::tr1 you…
Re: Linked List of Pointers
Programming
Software Development
16 Years Ago
by Kanvas
…]http://www.onlamp.com/pub/a/onlamp/2006/05/04/
smart
-
pointers
.html?page=1[/url] try reading this... it's kind… also explains the RAII idiom and a large variety of
smart
pointers
. If your STL version doesn't have std::tr1 you…
Re: Is it possible to work with out pointers and some OOP in C++?
Programming
Software Development
14 Years Ago
by mike_2000_17
… of polymorphism in OOP. Although they often use
smart
-
pointers
too (which you may or may not consider … .... the number of examples of real-life uses of
pointers
is uncountable. They are ubiquitous. They are only (almost…(APIs) which cannot pass objects or references, so
pointers
are thus necessary for proper Application Binary Interfacing (ABI)…
Re: Use of pointers to hierarchical data structures in C++
Programming
Software Development
14 Years Ago
by rubberman
… BE A LOT EASIER! There are techniques, such as using
smart
pointers
and reference counters to hold your Segments and such, so… you have to. In your classes, your member variables were
pointers
, and that isn't necessary. Since you have to allocate… them if you declare them as
pointers
, and then you have to destroy them also. Two …
Re: Use of pointers to hierarchical data structures in C++
Programming
Software Development
14 Years Ago
by rwarlord
… agree that I had used many native
pointers
unnecessarily; references, store-by-values, and
smart
pointers
can do better jobs. I had not…
1
2
3
7
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC