<commit_before>selfdestructing-cpp
===================

This is a small C++ "artwork" - classes that deliberately crash on object construction.

The goal is to create a DSL that is readable in English.

The project is meant to be a work in progress, since there are lots of possibilites of use and configuration of such classes.

Use?
----

A the primary use is (self-)education. Other uses may include debugging legacy code, class policy enforcement, and perhaps something else I cannot think of.

Test: see selfdestructing.cpp

````cpp
struct TestNumberCrash : public crashes::on<2>::copies {};
````
- crashes on 2 total copies of the originally created object
- doesn't crash on 2 total instances of the class



````cpp
struct TestCopyNrCrash : public crashes::after<2>::copies {};
````
- crashes on any second copy of the original object
- doesn't crash on 2 total instances of the class 



````cpp
struct TestTotalNrCrash : public crashes::on_total<3,TestTotalNrCrash>::instances {};
````
- crashes on 2 total live instances of the class
- doesn't crash on any creation if the total amount of instances is below 3

````cpp
struct TestAfterTotalNrCrash : public crashes::after_total<2,TestAfterTotalNrCrash>::instances {};
````
- crashes after any 2 instantiations of the class

License
=======
Author: <NAME>

MIT License (http://www.opensource.org/licenses/mit-license.php)<commit_msg>corrected readme<commit_after>selfdestructing-cpp
===================

This is a small C++ "artwork" - classes that deliberately crash on object construction.

The goal is to create a DSL that is readable in English.

The project is meant to be a work in progress, since there are lots of possibilites of use and configuration of such classes.

Use?
----

A the primary use is (self-)education. Other uses may include debugging legacy code, class policy enforcement, and perhaps something else I cannot think of.

Test: see selfdestructing.cpp

````cpp
struct TestNumberCrash : public crashes::on<2>::copies {};
````
- crashes on 2 total copies of the originally created object
- doesn't crash on 2 total instances of the class

---


````cpp
struct TestCopyNrCrash : public crashes::after<2>::copies {};
````
- crashes on any second copy of the original object
- doesn't crash on 2 total instances of the class 

---

````cpp
struct TestTotalNrCrash : public crashes::on_total<3,TestTotalNrCrash>::instances {};
````
- crashes on instantiation of an object if 2 objects are alive
- doesn't crash on any creation if the total amount of instances is below 2

---

````cpp
struct TestAfterTotalNrCrash : public crashes::after_total<3,TestAfterTotalNrCrash>::instances {};
````
- crashes after a third object instantiation of the class

---

Singular form alias is also available, i.e. `crashes::on<1>::copy`.

There's no thread-safe policy yet.

License
=======
Author: <NAME>

MIT License (http://www.opensource.org/licenses/mit-license.php)
{'fraction_non_alphanumeric': 0.11217183770883055, 'fraction_numerical': 0.006818956699624957, 'mean_word_length': 4.664092664092664, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3239562', 'n_tokens_mistral': 862, 'n_tokens_neox': 786, 'n_words': 360}