Can not overload template method function with const. Bug?

Tobias Pankrath tobias at pankrath.net
Wed Aug 8 06:49:45 PDT 2012


You currently can't use Tuples with std.container.Array (Bug 
#8284)

To fix this, I tried to overload the opEquals(R)(R rhs) of Tuple 
with
a const version opEquals(R)(R rhs) const. But the compiler does 
not use the overload if opEquals is called on a const tuple 
instance.

See this thread in d.learn 
http://forum.dlang.org/thread/vghlctzlpqxhoeojqqxt@forum.dlang.org

The orignal bug is solved, if you mark the current opEquals 
const, but I don't know if this would brake code outside of 
phobos, so I tried the overload.

Coming to the question: Is it a bug that the const overload is 
not considered and what is the correct way to fix 
std.typecons.Tuple?





More information about the Digitalmars-d mailing list