Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 154 results for
raii
- Page 1
RAII is this right?
Programming
Software Development
13 Years Ago
by lochnessmonster
from my understanding,
RAII
is where u make an object out of something that performs allocation on the heap to release its resources back to the O/S? (heap allocation,opening streams,file handles,etc...)
Re: RAII is this right?
Programming
Software Development
13 Years Ago
by drkybelk
Well
RAII
stands for Resource Acquisition is Initialisation. And Yes you are …
Beginning C++0x: Making a RAII Class
Programming
Software Development
12 Years Ago
by mike_2000_17
…return *this; }; // 4 - Destructor ~non_copyable_int_vector() { delete[] ptr; }; }; [/CODE] [B]
RAII
Resource[/B] If we can old the resource via a… v(aV) { }; }; [/CODE] The above illustrates how composition of
RAII
classes become
RAII
themselves with no effort. Here the [ICODE]int_vector_wrapper[/ICODE…
Re: still looking for RAII advice
Programming
Software Development
13 Years Ago
by mike_2000_17
… going to show you how to implement the processHandle in
RAII
, the others are for you to do in a similar…
Beginning C++0x: Design of Ownership
Programming
Software Development
12 Years Ago
by mike_2000_17
… clear and clean, and making a habit of writing
RAII
classes generally makes things even easier (see my last …as above, that is, use objects with automatic behavior (
RAII
) to manage memory with the strategy appropriate for each case… expert-level designs and encapsulated within a class (a
RAII
class) or within the implementation of a function, but…
Re: Move Constructor
Programming
Software Development
11 Years Ago
by mike_2000_17
…your resource-holding classes should be implemented as simple
RAII
wrappers for the given resource (file, memory, network… connection, external object, etc.). When implementing those
RAII
classes, you'll have to implement the Big Five…Fives, because all the underlying data members are
RAII
objects, which means that the compiler-generated copy…
Re: Beginning C++0x: Design of Ownership
Programming
Software Development
12 Years Ago
by sergent
Can you also post a link to your last C++0x tutorial (about
RAII
Class)? I haven't finished reading it and I lost the link :( #EDIT# Never mind, I found [URL="http://www.daniweb.com/software-development/cpp/tutorials/373787"]it[/URL].
What is your favorite idiom or design pattern?
Programming
Software Development
13 Years Ago
by mike_2000_17
…. It is very hard to choose between Smart Pointers and
RAII
. They both are an invaluable part of "memory management… made easy". But I would have to go with
RAII
just for the shear elegance of the resulting code. I…
Re: Well-written parallelised code using C++11 features?
Programming
Software Development
9 Years Ago
by mike_2000_17
… good use of templates, smart pointers,
RAII
, STL, Making good use of templates, smart pointers,
RAII
and the STL... to me, that…
Windows 7 ThreadpoolWait API design flaw?
Programming
Software Development
12 Years Ago
by doug65536
…->handle, &self->timeout); } }; [/CODE] AutoCloseThreadpoolWait is a
RAII
object that automates safely shutting down the threadpool object. When…
Move Constructor
Programming
Software Development
11 Years Ago
by abdelhakeem
….com/software-development/cpp/tutorials/373787/beginning-c0x-making-a-
raii
-class And I was confused by something: " `int_vector(int_vector…
Well-written parallelised code using C++11 features?
Programming
Software Development
9 Years Ago
by bythescruff
…, but anything which makes good use of templates, smart pointers,
RAII
, STL, and exceptions would be interesting.
Re: Goto statements: When are they useful?
Programming
Software Development
9 Years Ago
by mike_2000_17
…version: int foo() { // ... lots of allocation of resources in
RAII
objects .. if ( some error detected ) return (some error code);…version: void foo() { // ... lots of allocation of resources in
RAII
objects .. if ( some error detected ) throw (some exception); // …
Re: Is it possible to work with out pointers and some OOP in C++?
Programming
Software Development
13 Years Ago
by mike_2000_17
… First, a very popular design pattern in C++ is
RAII
(Resource Allocation Is Initialization). This just means that when … in the vector class). By making great use of
RAII
, you will typically end up with code that makes…1000 times more effective than procedural programming. Note, how
RAII
is based on encapsulation and how smart pointers use …
Re: Delete in destructors?
Programming
Software Development
12 Years Ago
by mike_2000_17
… of "scope-based resource management" (or
RAII
for "Resource Acquisition Is Initialization). Classes like […[ICODE]std::string[/ICODE] are examples of array-like
RAII
classes, and classes like [ICODE]std::shared_ptr[/ICODE] …www.daniweb.com/software-development/cpp/tutorials/373787"]
RAII
[/URL] and [URL="http://www.daniweb.com…
Re: Class members as paramaters
Programming
Software Development
13 Years Ago
by mike_2000_17
…exceptions or have some failure-state behavior.
RAII
(Resource Allocation Is Initialization) is a…file_read(); //destructor, closes file if still open. }; //
RAII
implementation: class file_read { .. public: file_read(const std::…;< std::endl; return; }; fin.close(); //
RAII
version: { //still need a try-catch for the…
Re: Deep copy problem
Programming
Software Development
12 Years Ago
by mike_2000_17
…daniweb.com/software-development/cpp/tutorials/373787"]
RAII
class[/URL]. As for your code: Line… //~Bullet(); //destructor not needed because all members are
RAII
. Bullet(const std::string& aName); Bullet(int startX… are not needed because all data members are
RAII
. int getX(); int getY(); int getDx(); int…
Re: deallocate contents of std::map
Programming
Software Development
13 Years Ago
by mike_2000_17
… proper example of the power of
RAII
[/QUOTE] If you mean that dynamic_bind is a
RAII
class, then I guess you could… say it is an example of
RAII
, I wouldn't really say it's a proper or…
Re: deallocate contents of std::map
Programming
Software Development
13 Years Ago
by mike_2000_17
… it with a file is not good
RAII
style. Sure, it's not. So what.
RAII
is very good, very often, but… local variable just so that you can remain in good
RAII
style, that's just putting your priorities at the wrong…
Re: Class Design Advice?
Programming
Software Development
13 Years Ago
by mike_2000_17
… invalid after stack unwinding. That's why
RAII
is so useful in C++. With
RAII
, you do the initialization in the constructor… observe that a better design would probably involve a few
RAII
classes to help this CodeInjector class. I bet you could…
Re: Strange memory leak error for functions called within functions
Programming
Software Development
12 Years Ago
by mike_2000_17
…object. But the real solution to this problem is
RAII
(Resource Acquisition Is Initialization), which is arguably the most… main() { DerivedHelper h; Foo f(h); //construct object of
RAII
class Foo. f.do_something(); //use the object f which is…a local Foo object that will use it temporarily.
RAII
is nice in this way that it naturally uses…
Re: Strange memory leak error for functions called within functions
Programming
Software Development
12 Years Ago
by TheWolverine
…[QUOTE]But the real solution to this problem is
RAII
(Resource Acquisition Is Initialization), which is arguably the …main() { DerivedHelper h; Foo f(h); //construct object of
RAII
class Foo. f.do_something(); //use the object f which is…local Foo object that will use it temporarily.
RAII
is nice in this way that it naturally uses…
Re: Managed C++/C++.net
Programming
Software Development
12 Years Ago
by mike_2000_17
… that are useless. In pure C++, and using the
RAII
idiom, the destructors are not something to "worry…Use dynamically allocated memory only under the wraps of a
RAII
class (like STL containers or smart-pointers). In this…http://www.daniweb.com/software-development/cpp/tutorials/373787"]
RAII
[/URL] and [URL="http://www.daniweb.com/…
Re: What variables must I delete?
Programming
Software Development
11 Years Ago
by mike_2000_17
…) that can help you, the first is on [
RAII
](http://www.daniweb.com/software-development/cpp/tutorials/373787/beginning…-c0x-making-a-
raii
-class) and the second is on [ownership relationships](…to the essentials, that is, make sure to use
RAII
classes as much as possible and use smart-pointers …
Re: Populating a pointer array of abstract objects with derived objects
Programming
Software Development
10 Years Ago
by mike_2000_17
…To write such a class correctly, you must write a
RAII
class (or resource-holding class), as explained [here](http….com/software-development/cpp/tutorials/373787/beginning-c0x-making-a-
raii
-class). Or, far simpler, just use a C++ … a destructor because both of these classes are standard
RAII
classes that manage their own resources (memory in this…
Re: corruption of the heap with char array passed to function
Programming
Software Development
10 Years Ago
by mike_2000_17
… a class that automatically manages it, we call that a [
RAII
class](http://www.daniweb.com/software-development/cpp/tutorials/373787…/beginning-c0x-making-a-
raii
-class) (
RAII
: Resource Acquisition Is Initialization, or a better term is…
Re: when to usee c++ over java?
Programming
Software Development
10 Years Ago
by mike_2000_17
… the situations when unique ownership is appropriate (e.g.,
RAII
-style data members or base-class, or `unique_ptr` pointers…destruction of objects, you largely have to give up
RAII
(automatic scope-based resource management), which will create …time of the code that uses that resource (through
RAII
classes), and therefore, you almost never have to …
Re: Why constructors don't have return types
Programming
Software Development
18 Years Ago
by Dante Shamest
Yes, one could use MFC's 2-stage construction. However, my personal preference is still to to use the constructor to create the object, because I'm used to the [url=http://www.hackcraft.net/
raii
/]
RAII
paradigm[/url], and my own wrappers for the Windows API use it.
Re: C++ / Exceptions
Programming
Software Development
17 Years Ago
by Darkmeerkat
… of a "[URL="http://en.wikipedia.org/wiki/
RAII
"]
RAII
[/URL]"-ish behavior, without having to split acquisition…
Re: Texturing n sided cone approximation
Programming
Software Development
13 Years Ago
by mike_2000_17
…, this cPyramid class is a very good candidate to use
RAII
(Resource Allocation Is Initialization). This means that in this case… and create a new one. That's the essence of
RAII
in the sense that you don't have to bother…
1
2
3
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
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
© 2024 DaniWeb® LLC