Comments (11)
The proposed solution at alex85k/libosmium@b397605 will not work.
Basically the problem is that a buffer needs to be moved into the *OutputBlock class and when the object is copied where does the Buffer go?
from libosmium.
I had a bad feeling about that buffer :) Currently the buffer is re-created, I guess. If we move the buffer or copy the pointer, can we guarantee that the objects will work as desired? I am completely new to move-constructors and had used only the trivial (primitive-type) cases of copy-constructors...
from libosmium.
Maybe this is the bug described in
http://stackoverflow.com/questions/11768273/why-cant-c11-move-a-noncopyable-functor-to-a-stdfunction
(only Visual Studio compiler wants to have copyable object for casting it into function)
/outdated/
from libosmium.
So, it seems that all functors should be copyable to be used as std::functions?
(Too C++-ish... So that is the reason why Java abandoned type conversions and operation overloadind :) )
/outdated/
from libosmium.
New info:
That is not a copy-constructor problem, that is just the same packaged_task<void()>
compiler bug-or-feature!
Close looking at the error:
std::packaged_task<result_type()> task(std::move(f));
2> D:\build_d\libosmium7\include\osmium/thread/pool.hpp(167) : see reference to function template instantiation 'std::packaged_task<result_type (void)>::packaged_task<osmium::io::detail::XMLOutputBlock>(_Fty2 &&)' being compiled
from libosmium.
Yes, as far as I can tell this is the same issue we had with XMLParser. packaged_task uses std::function internally and that needs a copyable functor on Windows. It works with a movable functor on Linux/OSX. Unfortunately the bug fix for XMLParser for Windows broke the OSX compile and I don't know why. So this is a complicated problem and needs more looking into.
from libosmium.
Here is the alternative fix:
alex85k@5318c1f
It compiles, however, I do no believe it works as needed :)
from libosmium.
Your code creates a dangling reference. Can you verify my commit works?
from libosmium.
Yes, it works! Thank you for another demonstration of C++ magic :)
from libosmium.
Should the solution for #32 (reference) (already added copy-constructor in the same situation) be the same or copying is really needed there?
from libosmium.
For #32 the solution is reasonably clean, so it should be kept that way. The fix for OPLOutputBlock and XMLOutputBlock is somewhat icky because it adds another redirection that should really not be necessary. But it was the simplest and cleanest I could come up with at the moment. There are some other problems with the threading code so I have to look at that code again anyway, maybe I can come up with a cleaner solution then.
from libosmium.
Related Issues (20)
- Unable to compile with c++20 when using precompiled binaries HOT 8
- Failing to compile libosmium: 'protozero/types.hpp' file not found HOT 5
- Incorrect proj usage HOT 1
- libosmium no longer successfully builds after `v2.17.1` on CentOS 7 HOT 2
- Need help, how to add altitude to libosmium HOT 2
- Missing prepare_for_lookup in test_members_database.cpp HOT 1
- heads-up: PROJ_LIB is now deprecated (use PROJ_DATA instead)
- io_test_bzip2 fails on Alpine Linux HOT 3
- AppVeyor builds fail due to missing LZ4 HOT 5
- Print offending string in PBF-Decoder
- installation make error HOT 2
- Does libosmium work with MacOS (M series chip)
- Performance Issues with `timegm` called from `parse_timestamp` on iOS 16.2 HOT 10
- Fractional seconds in XML timestamps HOT 2
- compiler error HOT 4
- What is the best practice for writing CPU-intensive handlers? HOT 4
- Reader class cannot record file types HOT 1
- Fails to read a bz2 file HOT 1
- location for one or more nodes not found in node location index HOT 2
- windows build is failing according to https://osmcode.org/status.html HOT 3
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 libosmium.