Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ldionne/libawful

A collection of awful archetypes to ease the testing of generic C++ libraries
https://github.com/ldionne/libawful

archetype cpp cpp11 cpp14 generic-programming testing

Last synced: about 2 months ago
JSON representation

A collection of awful archetypes to ease the testing of generic C++ libraries

Awesome Lists containing this project

README

        

# libawful ![Travis status][badge.Travis]

> A collection of awful archetypes for testing generic code

## Overview
When writing a generic library, one often needs to test generic components with
types having infrequent characteristics. This is to make sure that a generic
component is not assuming more about its inputs than it should. __libawful__
is a collection of types with unusual properties that can be used to check for
corner cases when implementing generic components. The project contains a single
header, ``, which defines all the archetypes.

```c++
#include
#include

template
struct naive_pair {
T first;
U second;

naive_pair() = default;

template ().first),
typename = decltype(std::declval().second)>
naive_pair(Other&& other)
: first(std::forward(other).first),
second(std::forward(other).second)
{ }
};

int main() {
naive_pair pair;
auto copy = pair; // ERROR: naive_pair tries to copy-construct its first
// member from a non-const reference to `pair.first`.
}
```

## Compiler requirements
This is a C++14 library, and no effort whatsoever will be made to accommodate
nonconforming compilers.

[badge.Travis]: https://travis-ci.org/ldionne/libawful.svg?branch=master