Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannah Bast committed Dec 17, 2024
1 parent 6956872 commit 53c701e
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/backports/concepts.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2024, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Author: Johannes Kalmbach <[email protected]>
// Copyright 2024, University of Freiburg
// Chair of Algorithms and Data Structures
// Author: Johannes Kalmbach <[email protected]>

#pragma once

Expand All @@ -10,23 +10,28 @@
#endif

// Define the following macros:
// `QL_CONCEPT_OR_NOTHING(arg)` which expands to `arg` in C++20 mode, and to
//
// `QL_CONCEPT_OR_NOTHING(arg)`: expands to `arg` in C++20 mode, and to
// nothing in C++17 mode. It can be used to easily opt out of concepts that are
// only used for documentation and increased safety and not for overload
// resolution.
//
// `QL_CONCEPT_OR_TYPENAME(arg)`: expands to `arg` in C++20 mode, and to
// `typename` in C++17 mode. Example usage:
//
// Example usages:
//
// `QL_CONCEPT_OR_NOTHING(std::view) auto x = someFunction();`
// `void f(QL_CONCEPT_OR_NOTHING(std::view) auto x) {...}`
//
// `QL_CONCEPT_OR_TYPENAME(arg)` which expands to `arg` in C++20 mode, and to
// `typename` in C++17 mode.
// `QL_CONCEPT_OR_NOTHING(SameAsAny<int, float>)`
//
// `void f(QL_CONCEPT_OR_NOTHING(std::view) auto x) {...}`
//
// Example usage:
// `template <QL_CONCEPT_OR_TYPENAME(ql::same_as<int>) T> void f(){...}`
//
// Note: The macros are variadic to allow for commas in the argument (e.g.
// `QL_CONCEPT_OR_NOTHING(SameAsAny<int, float>)`.
// NOTE: The macros are variadic to allow for commas in the argument, like in
// the second example above.

#ifdef QLEVER_CPP_17
#define QL_CONCEPT_OR_NOTHING(...)
#define QL_CONCEPT_OR_TYPENAME(...) typename
Expand All @@ -39,10 +44,12 @@
// C++20 standard as well as in `range-v3`.
namespace ql {
namespace concepts {

#ifdef QLEVER_CPP_17
using namespace ::concepts;
#else
using namespace std;
#endif

} // namespace concepts
} // namespace ql

0 comments on commit 53c701e

Please sign in to comment.