C++, C++11/C++14

Posts, notes, resources on C++, C++11/C++14.

Table of Contents

C++11 timing code execution

cf. Solarian programmer gave an excellent write up in C++11 timing code performance

C++11/14 version – the classic algorithm of binary search, using C++11/14 vector library

I implemented the classic algorithm of binary search using C++11/14 vector(s) (library) in vectors_binarysearch.cpp, inside the folder ../Cpp14 of my CompPhys github repository

functor

C++ Tutorial – Functors(Function Objects) – 2016

My implementation of the examples above for functors here on github:

functors.cpp

C++ templates, class templates and how to put them into header files; Useful links related to splitting up header files for declaration, split to .cpp files for definitions

While I already wrote about it in the README.md of my github repository folder Cpp, for CompPhysUseful links related to splitting up header files for declaration, split to .cpp files for definitions, github repo CompPhys, folder cpp, I had to look it up again, and so I’ll reiterate that material here.

, had an excellent article detailing how understandably confusing it is to split up templates to header files for C++.  The examples and options are comprehensive and crystal-clear.

Gives the reason why.

 

Texture Object API

struct cudaResourceDesc resDesc

struct myStruct myVariable;

struct Leopard leopard;
leopard.base.animal.weight = 44;

Struct declaration
http://en.cppreference.com/w/c/language/struct

Google search
struct inherit copy from another struct declare c c++

http://stackoverflow.com/questions/1114349/struct-inheritance-in-c

Typesafe inheritance in C
http://www.deleveld.dds.nl/inherit.htm

Difference between ‘struct’ and ‘typedef struct’ in C++?
http://stackoverflow.com/questions/612328/difference-between-struct-and-typedef-struct-in-c

Google search
typedef struct

useful

typedef struct vs struct definitions [duplicate]
http://stackoverflow.com/questions/1675351/typedef-struct-vs-struct-definitions

Google search terms

how to declare an instance of a struct C++

Proper way to initialize C++ structs

http://stackoverflow.com/questions/5914422/proper-way-to-initialize-c-structs

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s