Git Product home page Git Product logo

cpp-testat3's Introduction

CPP-Testat3 - Indexable Set Class Template

Create a class template indexableSet<T,COMPARE=std::less> that inherits from std::set<T,COMPARE> and allows indexing its content like you could do with a std::vector. Negative indices should index from the "end" of the set. Provide also member functions front() and back() that correspond to those of vector.

Write Test cases and implementation code for indexableSet for the following aspects:

  • all constructors available for std::set should work identically for indexableSet
  • Index access should reveal the stored values in sorted order
  • negative indices should index the set from the end, so that s[-1] is the last available (the greatest) element in the set and s[-s.size()] == s[0]
  • provide member functions front() and back()
  • all of your operations that might result in undefined behavior, because an index is out of range, or no elements exist should throw a corresponding standard exception.
  • allow instantiating indexableSet with a different compare functor. Demonstrate that with a test case with your own caselessCompare functor for std::string. (indexableSetstd::string,caselessCompare)

Note: Implement the template class indexableSet as header-only (indexableSet.h) within your CUTE test project.

Note: remember the rules for class templates inheriting from a class that also depends on a template parameter! Otherwise interesting effects for name lookup might happen. Omitting that will cause you to fail!

cpp-testat3's People

Contributors

innerjoin avatar

Watchers

 avatar  avatar

cpp-testat3's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.