Skip to content

Commit 66e8657

Browse files
authored
Update README.md
1 parent 8ffe5a7 commit 66e8657

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

README.md

+17-24
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ The Art of C++ / Operators is a zero-dependency C++11 single-header library that
1010

1111
### Table of Content
1212

13-
[Preface](#preface)<br/>
14-
[Rationale](#rationale)<br/>
13+
[Overview](#overview)<br/>
1514
[Example](#example)<br/>
1615
[Requirements](#requirements)<br/>
1716
[Installation](#installation)<br/>
@@ -21,34 +20,24 @@ The Art of C++ / Operators is a zero-dependency C++11 single-header library that
2120
[constexpr](#constexpr)<br/>
2221
[noexcept](#noexcept)<br/>
2322
[Changelog](#changelog)<br/>
23+
[History](#history)<br/>
2424
[License](#license)
2525

26-
## Preface
26+
## Overview
2727

28-
The Art of C++ / Operators is the next logical step in the evolution of the
29-
[Boost.Operators](http://www.boost.org/doc/libs/1_66_0/libs/utility/operators.htm) library,
30-
whose maintainer I became in 2002. Since then, C++ has changed significiantly and
31-
with C++11, the time has come for a complete rewrite and to get rid of some
32-
*very* old legacy code and work-arounds.
28+
Overloaded operators for class types typically don't come alone.
29+
For example, when `x + y` is possible then `x += y` should be, too.
30+
When `x < y` is possible then `x > y`, `x >= y`, and `x <= y` should be, too.
3331

34-
## Rationale
32+
Implementing large sets of operators, possibly for multiple classes, is both tedious and error-prone.
33+
However, more often than not, some of these operators can be defined in terms of others.
34+
For example `x >= y` can frequently be defined as `!(x < y)`.
3535

36-
Overloaded operators for class types typically occur in groups.
37-
If you can write `x + y`, you probably also want to be able to write `x += y`.
38-
If you can write `x < y`, you also want `x > y`, `x >= y`, and `x <= y`.
39-
Moreover, unless your class has really surprising behavior, some of these related operators
40-
can be defined in terms of others (e.g. `x >= y` &equiv; `!(x < y)`).
36+
Given the implementation of some basic operators, the templates in the Art of C++ / Operators can generate many more operators automatically.
4137

42-
Replicating these operators for multiple classes is both tedious and error-prone.
43-
The Art of C++ / Operators templates help by generating operators for you based on
44-
other operators you've defined in your class.
45-
46-
The generated operators are overloaded to take full advantage of move-aware types
47-
and are carefully written to allow the compiler to apply important optimizations
48-
to avoid unneccessary temporary objects. All generated operators are automatically
49-
marked `noexcept` when the underlying base operations are themself marked as
50-
`noexcept`. The generated comparison operators are also marked `constexpr`
51-
(if properly supported by the compiler).
38+
The generated operators are overloaded to take advantage of movable types, and allow the compiler to avoid unneccessary temporary objects wherever possible.
39+
All generated operators are `noexcept` when the underlying operations are `noexcept`.
40+
Generated comparison operators are `constexpr` (when supported by the compiler).
5241

5342
## Example
5443

@@ -949,6 +938,10 @@ Released 2018-02-13
949938

950939
* Initial release.
951940

941+
## History
942+
943+
The Art of C++ / Operators is a modernised C++11 rewrite of the [Boost.Operators](http://www.boost.org/doc/libs/1_66_0/libs/utility/operators.htm) library.
944+
952945
## License
953946

954947
The Art of C++ is certified [Open Source](http://www.opensource.org/docs/definition.html) software. It may be used for any purpose, including commercial purposes, at absolutely no cost. It is distributed under the terms of the [MIT license](http://www.opensource.org/licenses/mit-license.html) reproduced here.

0 commit comments

Comments
 (0)