-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Early stage bindings for std::unordered_map on linux #18
base: v1.x.x
Are you sure you want to change the base?
Conversation
This serves as the beginning module for unordered_map container. currently, this serves only Gcc runtime with the possible bindable functions for now
6f130d0
to
3cc444f
Compare
3cc444f
to
aac8641
Compare
source/stdcpp/unordered_map.d
Outdated
@@ -0,0 +1,103 @@ | |||
/** | |||
* D header file for interaction with C++ std::unordered_map. | |||
* |
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.
See_Also:
https://en.cppreference.com/w/cpp/container/unordered_map
source/stdcpp/unordered_map.d
Outdated
alias unordered_map(Key, value) = unordered_map!(Key, value, hash!Key, equal_to!Key, allocator!(pair!(const(Key), value))); | ||
extern(C++, class) struct unordered_map(Key, value, Hash, KeyEqual, Alloc) |
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.
Use default parameter for better API.
alias unordered_map(Key, value) = unordered_map!(Key, value, hash!Key, equal_to!Key, allocator!(pair!(const(Key), value))); | |
extern(C++, class) struct unordered_map(Key, value, Hash, KeyEqual, Alloc) | |
extern(C++, class) struct unordered_map(Key, value, Hash = hash!Key, KeyEqual = equal_to!Key, Alloc = allocator!(pair!(const(Key), value))) |
Unless that does not work ?
source/stdcpp/unordered_map.d
Outdated
/// | ||
extern(D) this(const ref unordered_map __a) | ||
{ | ||
allocator_type alloc_instance = allocator_type.init; | ||
this(__a, alloc_instance); | ||
} |
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.
Why is it extern(D)?
source/stdcpp/unordered_map.d
Outdated
/// | ||
extern(D) this(size_type __x) | ||
{ | ||
allocator_type alloc_instance = allocator_type.init; | ||
Hash hash_instance = Hash.init; | ||
key_equal equal_instance = key_equal.init; | ||
this(__x, hash_instance, equal_instance, alloc_instance); | ||
} | ||
/// |
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.
Why extern(D)
?
This PR is broken down into three simple commits on the following
std::unordered_map
targetingCppRuntime_Gcc
stdcpp.Hashtable
module for unordered_map. it is imported in stdcpp.unordered_map module for a better code organization