¡@

Home 

c++ Programming Glossary: another

What is a smart pointer and when should I use one?

http://stackoverflow.com/questions/106508/what-is-a-smart-pointer-and-when-should-i-use-one

block of code or if you embedded it as member data inside another object the lifetime of that other object. The object exists.. is not tied directly to a particular section of code or to another object. There is one drawback to reference counted pointers..

What are the rules about using an underscore in a C++ identifier?

http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier

begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. All identifiers..

How to split a string in C++?

http://stackoverflow.com/questions/236129/how-to-split-a-string-in-c

faq stdstring share improve this question FWIW here's another way to extract tokens from an input string relying only on standard..

What is move semantics?

http://stackoverflow.com/questions/3106110/what-is-move-semantics

. Its job is to move resources from one object to another instead of copying them. Congratulations you now understand..

What is the copy-and-swap idiom?

http://stackoverflow.com/questions/3279543/what-is-the-copy-and-swap-idiom

the goal of move construction to take the resources from another instance of the class leaving it in a state guaranteed to be..

When should static_cast, dynamic_cast and reinterpret_cast be used?

http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-and-reinterpret-cast-be-used

the cast operators to convert pointers of one type to another. I am familiar with the risks and benefits of pointer casting.. just casting downwards you can cast sideways or even up another chain. The dynamic_cast will seek out the desired object and.. be used very sparingly. It turns one type directly into another such as casting the value from one pointer to another or storing..

What can I use to profile C++ code in Linux?

http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux

cost is only that it is big enough to be worth fixing. Yet another way to look at it is called the Rule Of Succession . If you..

Undefined Behavior and Sequence Points

http://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points

expression is an expression that is not a subexpression of another expression. 1 Example int a 5 is a sequence point here in the..

How do I use arrays in C++?

http://stackoverflow.com/questions/4810664/how-do-i-use-arrays-in-c

in the face of exceptions but that is the topic of another FAQ . Note This is meant to be an entry to Stack Overflow's..

When to use forward declaration?

http://stackoverflow.com/questions/553682/when-to-use-forward-declaration

when I am allowed to do forward declaration of a class in another class's header file Am I allowed to do it for a base class for..

What are the differences between pointer variable and reference variable in C++?

http://stackoverflow.com/questions/57483/what-are-the-differences-between-pointer-variable-and-reference-variable-in-c

variable itself it is safe to think of a reference as another name for the same variable. Note What a pointer points to can..

Where and why do I have to put the “template” and “typename” keywords?

http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords

keywords. Other aspects should be handled in another answer or another FAQ entry. In order to parse a C program you.. Other aspects should be handled in another answer or another FAQ entry. In order to parse a C program you need to know for.. them into logically different groups One catches types another catches expressions. Expressions may depend by their value and..

Can a local variable's memory be accessed outside its scope?

http://stackoverflow.com/questions/6441218/can-a-local-variables-memory-be-accessed-outside-its-scope

its local variables come alive. When that method calls another method the new method's local variables come alive. They'll..

How to detect whether there is a specific member variable in class?

http://stackoverflow.com/questions/1005476/how-to-detect-whether-there-is-a-specific-member-variable-in-class

studio templates g sfinae share improve this question Another way is this one which relies on SFINAE for expressions too...

Does the 'mutable' keyword have any purpose other than allowing the variable to be modified by a const function?

http://stackoverflow.com/questions/105014/does-the-mutable-keyword-have-any-purpose-other-than-allowing-the-variable-to

through the public interface like your locking example. Another example would be a class that computes a value the first time..

What is a smart pointer and when should I use one?

http://stackoverflow.com/questions/106508/what-is-a-smart-pointer-and-when-should-i-use-one

pointer because of that the object is never destroyed Another possibility is creating circular references. struct Owner boost..

Start thread with member function

http://stackoverflow.com/questions/10673585/start-thread-with-member-function

in the previous item f t1 t2 ... tN in all other cases. Another general fact which I want to point out is that by default the..

What is “cache-friendly” code?

http://stackoverflow.com/questions/16699247/what-is-cache-friendly-code

ATLAS . Know and exploit the implicit structure of data Another simple example which many people in the field sometimes forget..

Default constructor with empty brackets

http://stackoverflow.com/questions/180172/default-constructor-with-empty-brackets

declaration even if resulting AST doesn't compile. Another instance of the same problem std ifstream ifs file.txt std vector..

Static linking vs dynamic linking

http://stackoverflow.com/questions/1993390/static-linking-vs-dynamic-linking

in statically linked binaries. Seems hard anyone know Another issue loading time. You pay loading costs at some point. When..

What is the point of function pointers?

http://stackoverflow.com/questions/2592137/what-is-the-point-of-function-pointers

n' private std string prompt_ functor f the answer is f 42 Another advantage is that it is sometimes easier to inline calls to..

Returning multiple values from a C++ function

http://stackoverflow.com/questions/321068/returning-multiple-values-from-a-c-function

int divide int dividend int divisor int remainder Another way would be to declare a struct to contain all of the results..

Optimizing away a “while(1);” in C++0x

http://stackoverflow.com/questions/3592557/optimizing-away-a-while1-in-c0x

that away it seems because it's not a loop but a jump. Another guy summarizes the proposed change in C 0x and C201X By writing..

What can I use to profile C++ code in Linux?

http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux

of the number of times it may occur within a sample. Another objection I often hear is It will stop someplace random and..

Pass by Reference / Value in C++

http://stackoverflow.com/questions/410593/pass-by-reference-value-in-c

3 are pass by reference while 2 would be pass by value. Another group of people say all but the last is pass by reference because..

Undefined Behavior and Sequence Points

http://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points

it is unspecified whether x or y will be evaluated first. Another example here . Now the Standard in §5 4 says 1 Between the previous..

Pretty-print C++ STL containers

http://stackoverflow.com/questions/4850473/pretty-print-c-stl-containers

cout Vector v std endl Incremental vector vv std endl Another vector vd std endl Pairs vp std endl Set ss std endl OMap..

Why can templates only be implemented in the header file?

http://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file

from declaration but is accessible to the compiler. Another solution is to keep the implementation separated and explicitly..

Type erasure techniques

http://stackoverflow.com/questions/5450159/type-erasure-techniques

or just edit the question I'll just do the safer one. Another nice technique to hide the actual type of something without..

Is there a way to instantiate objects from a string holding their class name?

http://stackoverflow.com/questions/582331/is-there-a-way-to-instantiate-objects-from-a-string-holding-their-class-name

you can do return map some_string Getting a new instance. Another idea is to have the types register themself in base.hpp template.. I'm sure there are better names for those two though. Another thing which probably makes sense to use here is shared_ptr ...

C++: When to use References vs. Pointers

http://stackoverflow.com/questions/7058339/c-when-to-use-references-vs-pointers

would be to use something similar to boost optional . Another example is to use pointers to raw memory for specific memory..

Understanding the meaning of the term and the concept - RAII (Resource Acquisition is Initialization)

http://stackoverflow.com/questions/712639/understanding-the-meaning-of-the-term-and-the-concept-raii-resource-acquisiti

the concept RAII Resource Acquisition is Initialization Another question I thought for sure would have been asked before but..