Skip to content

abidanBrito/set-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

set-class

WIP_Badge MIT license Build Status Codacy Badge

A rather basic set class in C++17, originally written for a school assignment. There are two separate implementations. One uses a static array, while the other relies on a vector container for optimized memory usage and ease-of-use. However, they are completely interchangeable, as they share member function signatures.

FEATURES

Implemented

  • Set creation / deletion.
  • Add elements.
  • Delete elements.
  • Empty a set.
  • Get the size.
  • Check for an element.
  • Check for a subset.
  • Check for a proper subset.
  • Complement of a set, given a universal set.
  • Union of two sets.
  • Arithmetic mean of a set.
  • Sort elements of a set.
  • Print out a set.

To Do

  • Difference of two sets.
  • Reverse difference of two sets.
  • Symmetric difference of two sets.
  • Intersection of two sets.
  • Cartesian product of two sets.
  • Mutable universal set.

USAGE

Add SetArray.h and SetArray.cpp, or SetVector.h and SetVector.cpp to your codebase of choice. Make sure to include the right header file for your needs:

#include "SetArray.h"
#include "SetVector.h"

COMPILATION

I have written two source files to try out the class: mainTests.cpp and mainTestsEspecific.cpp. If you feel inclined to compile them, make sure to comment / uncomment the following line at the top, to switch between implementations.

#define VECTOR

Feel free to use the provided makefile or code/build.bat (if you're on Windows). If you wish to compile it on your own, make sure to configure the compiler toolchain for C++17.

LICENSE

This repository is released under the MIT license. See LICENSE.md for more information.

About

Set operations with ease.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published