Comments (4)
I think this was caused by attribute inferrence not working on the various functions in HashMap. The problem is that the @nogc
-ness of the HashMap depends on the hash function also being @nogc
.
from containers.
One can get around @nogc attributes by casting. Making the hash function(s) predicates with defaulting to the built in types might be the way to go?
from containers.
Druntime should offer @nogc
hashing for basic types. Structs and classes will work if they implement toHash() @nogc
. Also all the container methods using hashes like insert(Key, Value)
would have to become templates for attribute inference to kick in.
I've just hit the same issues when implementing a hash table. For now I'll use a separate hashOf()
function that reimplements hashing of basic types.
@Stretto Predicates for the hash function are a good idea. It is just not quite so obvious to have as the less comparator in sorted lists. There may be many ways in which one thing is greater than another, but typically only one way it equals another.
from containers.
I don't think this is practical right now in D. We need to select the attributes (with/without @nogc
) depending on the allocator and the supportGC
parameter, which is currently doable only by duplicating all function declarations. Inference for template functions is usable but only for methods and not e.g. destructors.
from containers.
Related Issues (20)
- HashMap initialization at compile time HOT 1
- Still issues in unrolled list HOT 1
- Shouldn't assume allocator is passed via reference/pointer
- CyclicBuffer unit test fails with 2.087 compiler
- UnrolledList -Wstringop-overflow HOT 2
- HashMap assert failure when passing non default allocator HOT 1
- Recursive template expansion with HashMap HOT 1
- feature request: hashset.insert(range!T inputs), i.e. add multiple elements in one call HOT 2
- unrolledlist.d unittest fails at line 637 HOT 5
- -betterC ? A question out of curiosity HOT 2
- Can we release a v0.8.1? HOT 4
- segfault with HashMap of RefCounted!HashMap HOT 1
- Cannot use HashSet as value type for HashMap HOT 2
- DynamicArray with non-copyable types. HOT 3
- UnrolledList insert doesn't work properly on ldc2 HOT 2
- DynamicArray should use std.experimental.allocator.common.reallocate
- TTree error in "contains" - "nogc"
- UnrolledList: item inserted at wrong location after a remove
- The benchmark example code from README.md fails to compile with recent DMD
- Get rid of deprecate warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from containers.