-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
9c03448
to
a7b5317
Compare
@kkaefer Do the changes to |
a7b5317
to
f94fc38
Compare
Layer* operator()(style::LineLayer&) && { return new LineLayer(map, cast<style::LineLayer>()); } | ||
Layer* operator()(style::RasterLayer&) && { return new RasterLayer(map, cast<style::RasterLayer>()); } | ||
Layer* operator()(style::SymbolLayer&) && { return new SymbolLayer(map, cast<style::SymbolLayer>()); } | ||
Layer* operator()(style::CustomLayer&) && { return new CustomLayer(map, cast<style::CustomLayer>()); } |
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.
This could be a template
function?
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.
@kkaefer I was hoping the same, but don't quite know how. The classes involved are not the same type, but named the same, eg mbgl::style::LineLayer
and mbgl::android::LineLayer
. Where the latter is a Peer class wrapping the former.
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.
This could be done by adding a typedef member to the mbgl::android::LineLayer
with a shared name (e.g. using LayerType = style::LineLayer
in mbgl::android::LineLayer
, then using a function like
template <class PeerType>
Layer* operator(typename PeerType::LayerType&) && {
return new PeerType(map, cast<typename PeerType::LayerType>());
}
Layer* operator()(style::LineLayer& layer) { return new LineLayer(map, layer); } | ||
Layer* operator()(style::RasterLayer& layer) { return new RasterLayer(map, layer); } | ||
Layer* operator()(style::SymbolLayer& layer) { return new SymbolLayer(map, layer); } | ||
Layer* operator()(style::CustomLayer& layer) { return new CustomLayer(map, layer); } |
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.
Could this be a template function?
Closing as this PR won't trigger CI. Replaced by #9069 |
Fixes #8758