-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport of some concepts from util to C++17 #1741
Open
gpicciuca
wants to merge
12
commits into
ad-freiburg:master
Choose a base branch
from
gpicciuca:cpp17-concepts-backport-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2ddfca9
Backport of some concepts from util to C++17
gpicciuca d58b3de
First steps that are working.
joka921 0a1bfc0
Also fixed the `isInstantion` occurence.
joka921 f844150
Working cpp20 build with util module concepts backport
gpicciuca a61f539
Fix some bugs.
joka921 c9511e5
Small fixes and Views and Iterators backporting
gpicciuca cb679e1
Fix the `ViewsTest` for now.
joka921 ad90c03
Bring this back to compilation
joka921 a035e0a
Backport concept isInstantiation
gpicciuca c4af1cc
Backport TypeTraits Similar-concepts
gpicciuca cb610e9
Backport BulkResultForDecoder
gpicciuca 8b2f5f5
Rewrite enable_if_t occurrences
gpicciuca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
#include <string> | ||
#include <vector> | ||
|
||
#include "backports/concepts.h" | ||
#include "global/Id.h" | ||
#include "util/ExceptionHandling.h" | ||
#include "util/File.h" | ||
|
@@ -71,6 +72,40 @@ struct CompactStringVectorWriter; | |
|
||
} | ||
|
||
// TODO<joka921, picciuca> : The following doesn't work if there is no `begin()` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noting this TODO for later, s.t. I can have a look at it again. |
||
// member in 17 mode. We need a different solution for this, but this is | ||
// currently only used in tests. Postponing this for now. | ||
#if false | ||
#ifdef QLEVER_CPP_17 | ||
template <typename T, typename = void> | ||
struct IsIteratorOfIterator : std::false_type {}; | ||
|
||
template <typename T> | ||
struct IsIteratorOfIterator< | ||
T, std::void_t<decltype(*(T::iterator::value_type::begin()))>> | ||
: std::true_type {}; | ||
|
||
template <typename T, typename DataType> | ||
CPP_concept IteratorOfIterator = | ||
(IsIteratorOfIterator<T>::value && | ||
ad_utility::SimilarTo<decltype(*(T::iterator::value_type::begin())), | ||
DataType>); | ||
#else | ||
template <typename T, typename DataType> | ||
concept IteratorOfIterator = requires(T t) { | ||
{ *(t.begin()->begin()) } -> ad_utility::SimilarTo<DataType>; | ||
}; | ||
#endif | ||
|
||
#endif | ||
|
||
template <typename T, typename U> | ||
concept DummySimilar = ad_utility::SimilarTo<T, U>; | ||
template <typename T, typename DataType> | ||
concept IteratorOfIterator = requires(T t) { | ||
{ *(t.begin()->begin()) } -> DummySimilar<DataType>; | ||
}; | ||
|
||
/** | ||
* @brief Stores a list of variable length data of a single type (e.g. | ||
* c-style strings). The data is stored in a single contiguous block | ||
|
@@ -102,10 +137,8 @@ class CompactVectorOfStrings { | |
* @brief Fills this CompactVectorOfStrings with input. | ||
* @param The input from which to build the vector. | ||
*/ | ||
template <typename T> | ||
requires requires(T t) { | ||
{ *(t.begin()->begin()) } -> ad_utility::SimilarTo<data_type>; | ||
} void build(const T& input) { | ||
CPP_template(typename T)( | ||
requires IteratorOfIterator<T, data_type>) void build(const T& input) { | ||
// Also make room for the end offset of the last element. | ||
_offsets.reserve(input.size() + 1); | ||
size_t dataSize = 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated versions of those, I will merge them in here myself later today or tomorrow.