How to translate this C++ function template? #1051
Unanswered
bluetarpmedia
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to translate the example C++ code from cppreference.com's priority_queue into Cpp2 but I've encountered some problems with this function template:
I can't find a way to inject
typename
as required for this expression:requires (std::ranges::input_range<typename Adaptor::container_type>)
.I think this is logged as [BUG] Can't pass dependent type template argument #727. Any ideas for a workaround?
This isn't a big deal but the
Printer
type cannot currently be nested:error: (temporary alpha limitation) a type must be in a namespace or type scope - function-local types are not yet supported
.I can't find a way to translate the
static_cast
. The Cpp2as
cast attempts adynamic_cast
which subsequently fails.This is my current best effort:
Full code on Godbolt
Current published version on cpp2reference
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions