Thanks to visit codestin.com
Credit goes to github.com

Skip to content

adammcclenaghan/cpp-data-structures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

I've been self learning C++ because its often used in areas where performance/efficiency is important.

Performance optimisation has often been my favourite sort of work throughout my career, I find it easy to get lost in the process of measurement, tweak, test and repeat, and I enjoy the creative problem solving that's often required to get the most out of the machine.

Writing a header only data structures library seemed like a decent small project. Particularly to help me gain a better understanding of "The rule of 5" and applying some of the techniques I've read about in Bjarne's "A tour of C++". I studied data structures & algorithms at University, but its been a while since I've thought about the implementation of some of these, particularly graphs/trees, and implementing them again has been a fun process :)

My vector implementation is interesting as it allows for OOB access, which is UB in C++. This was my first real brush with UB and it lead me down a merry path where I used valgrind to discover that something like:

data_ = new T[capacity_];

may result in the allocator requesting more memory than you'd think, and so you may not segfault until you try to greatly exceed capacity (but it depends, hence the name "undefined behaviour") :)

I have future plans to write another project which uses these data structures to implement some common algorithms.

Build

Admittedly, I have only tested building on my laptop & desktop. Depending on which compilers you have installed locally, you may need to tweak the Makefile. I may make a Dockerfile when I get a chance.

make

Testing

Requires GTest headers

sudo apt-get install libgtest-dev

Run:

make test

About

Header only template library of data structures written in C++, primarily for my own learning :)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published