¡@

Home 

c++ Programming Glossary: e.g

In what cases do I use malloc vs new?

http://stackoverflow.com/questions/184537/in-what-cases-do-i-use-malloc-vs-new

should pair with delete and it is a mistake to mix the two e.g. Calling free on something that was created with the new operator..

What are all the common undefined behaviour that a C++ programmer should know about? [closed]

http://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviour-that-a-c-programmer-should-know-ab

greater than or equal to the number of bits in the number e.g. int64_t i 1 i 72 is undefined Types Cast and Const Casting.. automatic variable before it has been definitely assigned e.g. int i i cout i Using the value of any object of type other..

Operator overloading

http://stackoverflow.com/questions/4421706/operator-overloading

idea to overload it. The standard library ™s algorithms e.g. std sort and types e.g. std map will always only expect operator.. The standard library ™s algorithms e.g. std sort and types e.g. std map will always only expect operator to be present. However..

Why do I get “unresolved external symbol” errors when using templates?

http://stackoverflow.com/questions/456713/why-do-i-get-unresolved-external-symbol-errors-when-using-templates

until they are used typically in a separate .cpp file e.g. the program source . When the template is used the compiler..

size of int, long, etc

http://stackoverflow.com/questions/589575/size-of-int-long-etc

required ranges and the ordering of type is still valid e.g. sizeof int sizeof long . The actual implementation specific..

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

So we have with typical examples appended Dependent types e.g a type template parameter T Value dependent expressions e.g.. a type template parameter T Value dependent expressions e.g a non type template parameter N Type dependent expressions e.g.. a non type template parameter N Type dependent expressions e.g a cast to a type template parameter T 0 Most of the rules are..

WChars, Encodings, Standards and Portability

http://stackoverflow.com/questions/6300804/wchars-encodings-standards-and-portability

representation may be totally different or not even exist e.g. TCP over carrier pigeon . Serializable things on the other.. on the other hand always have the same representation e.g. the PNG file I can read on my Windows desktop on my phone or.. write two boiler plate wrappers for my program entry point e.g. for C Portable wmain wrapper #include clocale #include cwchar..

What is a lambda expression in C++11?

http://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11

cases the return type of the lambda is deduced for you e.g. void func4 std vector double v std transform v.begin v.end.. where the return type cannot be deduced by the compiler e.g. void func4 std vector double v std transform v.begin v.end.. expression which has so far been unused in these examples e.g. void func5 std vector double v const double epsilon std transform..

Singleton: How should it be used

http://stackoverflow.com/questions/86582/singleton-how-should-it-be-used

Sometimes the OS or the JVM creates singletons for you e.g. in Java every class definition is a singleton Provide a destructor..

How to overload std::swap()

http://stackoverflow.com/questions/11562/how-to-overload-stdswap

specializations for your own types to the std namespace. E.g. namespace std template void swap my_type lhs my_type rhs ..... of swap isn't good enough for your derived types. E.g. if you have class Base ... stuff ... class Derived public Base..

Difference between A* pA = new A; and A* pA = new A();

http://stackoverflow.com/questions/1581763/difference-between-a-pa-new-a-and-a-pa-new-a

non union class types without a used declared constructor. E.g. struct A int a std string s A is a non POD class type without..

In C++, how do you clear a stringstream variable?

http://stackoverflow.com/questions/20731/in-c-how-do-you-clear-a-stringstream-variable

ios and is used to clear the error state of the stream. E.g. if a file stream has the error state set to eofbit end of file..

Why isn't it legal to convert “pointer to pointer to non-const” to a “pointer to pointer to const”

http://stackoverflow.com/questions/2220916/why-isnt-it-legal-to-convert-pointer-to-pointer-to-non-const-to-a-pointer-to

to pointer to non const to a pointer to pointer to const E.g. why is the following code illegal char s1 0 const char s2 s1..

Purpose of Unions in C and C++

http://stackoverflow.com/questions/2310483/purpose-of-unions-in-c-and-c

the purpose of unions AND not on what the standard allows E.g. Using inheritance for code reuse is of course allowed by the..

Why pass by const reference instead of by value?

http://stackoverflow.com/questions/2582797/why-pass-by-const-reference-instead-of-by-value

the compiler can make when the object is a a local object. E.g. In the first form in the body of f it cannot be assumed that.. void f Obj a Obj b a is local b cannot be a reference to a E.g. In the first example the compiler may be able to assume that..

Easy framework for OpenGL Shaders in C/C++

http://stackoverflow.com/questions/2795044/easy-framework-for-opengl-shaders-in-c-c

drawing the objects you want shaded with each shader. E.g. void draw static shader_prog wall_shader wall_vertex wall_frag..

what is/are the purpose(s) of inline?

http://stackoverflow.com/questions/3647053/what-is-are-the-purposes-of-inline

read the documentation on their optimization switches. E.g GCC does something similar You can also direct GCC to try to..

What is the curiously recurring template pattern (CRTP)?

http://stackoverflow.com/questions/4173254/what-is-the-curiously-recurring-template-pattern-crtp

which is a template specialization for the class A itself. E.g. template class T class X ... class A public X A ... It is curiously..

Java's final vs. C++'s const

http://stackoverflow.com/questions/4971286/javas-final-vs-cs-const

const instances. Java does not have an equivalent to this. E.g. class Foo public void bar void foo const void test const Foo.. things as non overridable. C pre C 11 does not do this. E.g. public class Bar public final void foo public class Error extends..

When should I use typedef in C++?

http://stackoverflow.com/questions/516237/when-should-i-use-typedef-in-c

as a compile time type value to obtain the resulting type. E.g. consider a simple metafunction for converting a pointer type..

Accessing inherited variable from templated parent class

http://stackoverflow.com/questions/605497/accessing-inherited-variable-from-templated-parent-class

variable or function or to provide a using declaration. E.g. template class T int Bar T Perna int u int c Foo T a 4 This..

When to use “new” and when not to, in C++? [duplicate]

http://stackoverflow.com/questions/679571/when-to-use-new-and-when-not-to-in-c

array of undetermined size it must be allocated via new. E.g. void foo int size Point pointArray new Point size ... delete..

C++: When to use References vs. Pointers

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

clear that the variables are being passed destructively. E.g. in the following code void add_one int n n 1 void add_one int..

Array placement-new requires unspecified overhead in the buffer?

http://stackoverflow.com/questions/8720425/array-placement-new-requires-unspecified-overhead-in-the-buffer

Though it is typically stable for any given platform. E.g. this is something specified by the Itanium ABI . If you don't..