You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://coveralls.io/github/bemanproject/exemplar?branch=main)[](https://godbolt.org/z/4qEPK87va)
8
+
[](https://coveralls.io/github/bemanproject/integer_division?branch=main)[](https://godbolt.org/z/4qEPK87va)
9
9
10
-
`beman.exemplar` is a minimal C++ library conforming to [The Beman Standard](https://github.com/bemanproject/beman/blob/main/docs/beman_standard.md).
11
-
This can be used as a template for those intending to write Beman libraries.
12
-
It may also find use as a minimal and modern C++ project structure.
13
-
14
-
**Implements**: `std::identity` proposed in [Standard Library Concepts (P0898R3)](https://wg21.link/P0898R3).
10
+
**Implements**: Integer division function templates
11
+
proposed in [Integer division (P3724R1)](https://wg21.link/P3724R1).
15
12
16
13
**Status**: [Under development and not yet ready for production use.](https://github.com/bemanproject/beman/blob/main/docs/beman_library_maturity_model.md#under-development-and-not-yet-ready-for-production-use)
17
14
18
15
## License
19
16
20
-
`beman.exemplar` is licensed under the Apache License v2.0 with LLVM Exceptions.
17
+
`beman.integer_division` is licensed under the Apache License v2.0 with LLVM Exceptions.
21
18
22
19
## Usage
23
20
24
-
`std::identity` is a function object type whose `operator()` returns its argument unchanged.
25
-
`std::identity` serves as the default projection in constrained algorithms.
26
-
Its direct usage is usually not needed.
21
+
- <code>std::div_<i>mode</i></code> is a family of functions that computes the quotient
22
+
of an integer division with rounding mode of choice
23
+
- <code>std::div_rem_<i>mode</i></code> is a family of functions that computes
24
+
the quotient and remainder simultaneously
25
+
-`std::mod` computes the remainder of the division with rounding towards negative infinity
27
26
28
27
### Usage: default projection in constrained algorithms
29
28
30
-
The following code snippet illustrates how we can achieve a default projection using `beman::exemplar::identity`:
29
+
The following demonstrates how these functions may be used:
31
30
32
31
```cpp
33
-
#include<beman/exemplar/identity.hpp>
34
-
35
-
namespaceexe = beman::exemplar;
36
-
37
-
// Class with a pair of values.
38
-
struct Pair
39
-
{
40
-
int n;
41
-
std::string s;
42
-
43
-
// Output the pair in the form {n, s}.
44
-
// Used by the range-printer if no custom projection is provided (default: identity projection).
0 commit comments