Confused by a compiler's finding of ambiguity among constructors
I'm working on an optional-reference class, supplementing std::optional for pre-C++26 code. I am trying to get my constructors right, and specifically, be able to construct from refs to the referred-to type T, to std::optional's, and to other optional-refs. There is also the matter of the constness of T, which is what I'm having all sorts of trouble with. So, here is a part of a possible implementation (whittled down for terseness while still triggering the ambiguity): #include <type_traits> #include <optional> // This is NOT a complete optional_ref! template<typename T> struct optional_ref {
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.