This document describes how to implement a concept exercise for the C++ track.
Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read the following documents:
Please also watch the following video:
As this document is generic, the following placeholders are used:
<SLUG>
: the slug of the exercise in kebab-case (e.g.calculator-conundrum
).<NAME>
: the name of the exercise in snake_case (e.g.calculator_conundrum
).<CONCEPT_SLUG>
: the slug of one of the exercise's concepts in kebab-case (e.g.anonymous-methods
).
Before implementing the exercise, please make sure you have a good understanding of what the exercise should be teaching (and what not). This information can be found in the exercise's GitHub issue. Having done this, please read the [C++ concept exercises introduction][concept-exercises].
To implement a concept exercise, the following files must be added:
languages └── cpp ├── concepts | └── <CONCEPT_SLUG> | ├── about.md | └── links.json └── exercises └── concept └── <SLUG> ├── .docs │ ├── hints.md │ ├── instructions.md │ ├── introduction.md | └── source.md (required if there are third-party sources) ├── .meta | |── config.json │ ├── design.md │ ├── exemplar.cpp │ └── exemplar.h ├── CMakeLists.txt ├── <NAME>.cpp ├── <NAME>.h ├── <NAME>_test.cpp └── test └── tests_main.cpp
The code files are track-specific and should be designed to help the student learn the exercise's concepts. The following C++ code files must be added (not necessarily in this order):
<NAME>.h
and<NAME>.cpp
. the stub implementation files, which is the starting point for students to work on the exercise.CMakeLists.txt
: the C++ project file.<NAME>_test.cpp
: the test suite..meta/exemplar.h
and.meta/exemplar.cpp
: an exemplar implementation that passes all the tests.test/tests_main.cpp
: generates test main from test library
How to create the files common to all tracks is described in the how to implement a concept exercise document.
- Add the exercise to the list of implemented exercises.
When implementing this exercise, it can be very useful to look at already implemented C++ exercises.
If you have any questions regarding implementing the exercise, please post them as comments in the exercise's GitHub issue.