Comments (6)
Interesting. I've clang-tidy enabled and cannot reproduce it though.
Can I ask you what param triggers the error? Maybe it's not the only one.
from entt.
It's this PR: https://github.com/TheOpenSpaceProgram/osp-magnum/pull/269/files , the file test/tasks/main.cpp which is the very bottom-most file in the review (at the time of writing).
The deprecation message says to switch from ::at(index)
to ::begin()[index]
, but i was actually able to switch to simply ::operator[](index)
directly.
However, originally (before i just switched to ::operator[](index)
)when i switched from ::at(index)
to ::begin()[index]
i got the warning from clang tidy i reported in my initial comment.
The types are:
'entt::internal::sparse_set_iterator<std::vector<osp::TaskId>>::difference_type'
, where osp::TaskId
is an enum-class backed by a uint32_t.
difference_type
should be std::ptrdiff_t
but apparently cpp reference thinks the only requirement is that it's a signed integer. Regardless, it's being calculated on my platform as long
.
rRand is type std::mt19937 &rRand
defined here: https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
which apparently returns std::uint_fast32_t and i guess on the github actions runner is of type unsigned long
.
runTasksLeft
is auto const runTasksLeft = rExec.tasksQueuedRun.size();
which i imagine is std::size_t, though i'm not 100% sure what the type of tasksQueuedRun
is off of the top of my head.
The full function is here:
since unsigned long
can't convert to long
without precision loss, we get the warning about narrowing conversions.
My recommendation is that you can either make the functions for sparse_set_iterator templated on the std::integral
concept, or you can define two versions, one for signed integers and another for unsigned.
But don't fix this on my account, since ::operator[](index)
works for me just fine. I just wanted to report the warning in case you wanted to fix it.
from entt.
Ohoo, I see, so the error is at the call site in your case and not in the body of the function, is it?
I got it the other way around initially. This would explain why it doesn't trigger on the CI at least.
from entt.
I checked the standard and a few implementations for the major compilers.
As expected, operator[]
for random access iterators is always defined in terms of difference_type
.
Therefore, I think I'll stick with the current implementation. Thanks for bringing it up though. 👍
from entt.
Do you mind sharing some of the random access iterators that you were looking at? I'm curious.
from entt.
You can check a few implementations here (working draft for the language). Then I checked the MSVC one from within VS (just look into the implementation of a container like the vector) and the ones offered by clang (easily available online). 👍
from entt.
Related Issues (20)
- Access violation when using registry.clear<Component>() HOT 9
- Is it possible to use entt::nth_argument_t with lambdas that capture? HOT 6
- Question it is posible to use Entt with lightweight wrapper class as a entt::entity HOT 2
- Calling valid() on empty entt::valid leads to a segmentation fault.
- Add ability to compare entt::null and entt::handle
- Components with overriden new operator. HOT 6
- Working with multiple storages for the same type and preparing a view for each of the storages HOT 3
- entt build error: unused type alias 'common_type' HOT 9
- assert on destroy (inside of release function) non-orphan entity HOT 8
- Handling large tilemap HOT 7
- Acecss components of an entity, without giving full registry access HOT 14
- bazel version and compatibility number out of sync HOT 5
- storage<entt::entity>("id"_hs) should be asserted against HOT 2
- Get a view of components with a certain trait HOT 2
- Groups not functioning without sigh_mixin HOT 1
- Reliability across a network?
- Can't emplace component derived from std::vector HOT 4
- Iterating over all entities HOT 2
- Documentation references the deprecated registry-based `entt::to_entity` API HOT 2
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 entt.