From abb693d4efc6948e3383cb81c5a467fc3b7390a4 Mon Sep 17 00:00:00 2001 From: Anton Bachin Date: Mon, 19 Oct 2020 08:26:14 +0300 Subject: [PATCH] Document BETTER_ENUMS_DECLARE_STD_HASH Follow-on to #77. [skip ci] --- doc/ApiReference.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/ApiReference.md b/doc/ApiReference.md index 40b97a6..74394e3 100644 --- a/doc/ApiReference.md +++ b/doc/ApiReference.md @@ -413,6 +413,21 @@ as [`_from_string`](#_from_string). In case of failure, sets the stream's +### Hashing + +#### macro BETTER_ENUMS_DECLARE_STD_HASH(Enum) + +Use this outside namespace scope to declare a specialization of `std::hash` for +the type `Enum`. For example: + + // This declaration might be inside a namespace. + BETTER_ENUM(Channel, int, Red, Green, Blue) + + // Later, outside the namespace: + BETTER_ENUMS_DECLARE_STD_HASH(Channel) + + + %% class = api %% description = Detailed description of the Better Enums API.