Hacker News new | past | comments | ask | show | jobs | submit login

You've confused RandomAccessIterator (a perfectly reasonable name for a Rust trait, but not really in the usual style of the C++ standard library) for std::random_access_iterator an actual concept defined in C++ 20

std::random_access_iterator like most of its fellows in C++ 20 is largely duck typed, there's a semantic "model" provided, but this is not enforced anywhere and your compiler will actually accept completely bogus types so long as the syntax matches. The standard washes its hands of the consequences by saying that if you don't obey the model your program is not valid C++ and the compiler is not expected to detect that and tell you about it.




No, on both counts. No, I did not confuse it, but chose not to quibble over spelling. And, no, C++ concepts are not limited to "duck typing".




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: