Define the following terms in OO context.
- class
- object
- interface
- abstract
- concrete
- inheritence
- composition
#include <vector> | |
#include <list> | |
#include <iostream> | |
#include <ctime> | |
// FIXME: v(1000000) creates a vector of 1000000 elements. At the end of the function there are 2000000 elements. Instead, it should be constructed empty and then v.reserve(1000000) should be called just after. | |
void createPreallocatedMillionVector() | |
{ | |
std::vector<int> v(1000000); |
Vector took 0.18 seconds. | |
Preallocated Vector took 0.1 seconds. | |
Back pushed List took 1.38 seconds. | |
Front pushed List took 1 seconds. | |
Front pushed Pool allocated list took 0.67 seconds. | |
In other words, | |
Preallocating a vector makes it ~200% faster than not preallocating | |
Pushing to the front makes it ~150% faster than pushing to the back | |
Pushing to the front and using a pool allocator makes it ~200% faster than pushing to the back |
#ifndef HASHEDSTRING_HPP_INCLUDED | |
#define HASHEDSTRING_HPP_INCLUDED | |
#include <irrlicht/irrTypes.h> | |
// if HASHEDSTRING_USE_CONSTEXPR is defined, a recursive constexpr hashing algorithm will be used. | |
// otherwise, an iterative runtime hashing algorithm will be used. | |
#define HASHEDSTRING_USE_CONSTEXPR | |
// do not touch this block of preprocessor. |
#include <cstdint> | |
// if HASHEDSTRING_USE_CONSTEXPR is defined, a recursive constexpr hashing algorithm will be used. | |
// otherwise, an iterative runtime hashing algorithm will be used. | |
#define HASHEDSTRING_USE_CONSTEXPR | |
// do not touch this block of preprocessor. | |
#ifdef HASHEDSTRING_USE_CONSTEXPR | |
#define HASHEDSTRING_CONSTEXPR_IMPL constexpr | |
#else |
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ |
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ |
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ |
# core {{{ | |
[core] | |
editor = vim | |
# }}} | |
# user {{{ | |
[user] | |
name = Nicolas Guillemot | |
email = nlguillemot@gmail.com | |
# }}} |
import derelict.opengl3.gl3; | |
void main(){ | |
DerelictGL3.load(); | |
} | |
/usr/local/lib/d/libDerelictGL3.a(gl3_8d_649.o):(.data+0x38): undefined reference to `_D8derelict4util6loader15SharedLibLoader7__ClassZ' | |
/usr/local/lib/d/libDerelictGL3.a(gl3_8d_649.o):(.rodata+0x2508): undefined reference to `_D8derelict4util6loader15SharedLibLoader4loadMFZv' | |
/usr/local/lib/d/libDerelictGL3.a(gl3_8d_649.o):(.rodata+0x250c): undefined reference to `_D8derelict4util6loader15SharedLibLoader4loadMFAyaZv' | |
/usr/local/lib/d/libDerelictGL3.a(gl3_8d_649.o):(.rodata+0x2510): undefined reference to `_D8derelict4util6loader15SharedLibLoader4loadMFAAyaZv' |