Skip to content

Instantly share code, notes, and snippets.

View kimgea's full-sized avatar
👋

Kim-Georg Aase kimgea

👋
View GitHub Profile
#include "stdafx.h"
#include <list>
#include <bitset>
#include <array>
#include <vector>
using namespace std;
// LOL what where I thinking
// Going to fancy trying to avoid inner loop O(N^2) and even hash function
@kimgea
kimgea / db_query_structure_excample.cpp
Created July 31, 2017 09:13
Fast and dirty code to show structure for a way to query on objects. Needs improvment for working with const and puting stuff in lists if chosen, and probably more.
#include "stdafx.h"
#include <string>
class collection {};
template<typename query_set_base_t>
struct query_set_base
{
query_set_base_t & select(const std::string & q) { return *static_cast<query_set_base_t*>(this); }
#include <string>
/*
Attempt to create dependency injections for easier testing without using dynamic polimorphism
Implementation is seperated into helper classes from the real usage classes.
This is to avoid using complex template types or auto to hold the instances
Updise:
- No vtables
@kimgea
kimgea / cpp-traits.cpp
Created April 6, 2017 14:35
c++ template specialization and template traits
#include <vector>
#include <list>
#include <set>
enum class insert_method_enum{general, push_back, push_front};
// Main template insert helper with its temlate specialications
template<insert_method_enum i>
@kimgea
kimgea / di.cpp
Created April 4, 2017 13:43
Dependency injection c++
#include <memory>
#include <string>
// Dependency injection for c++
////////////////////////////////////////////////////////
//
//