Fix warning 4996 on Microsoft compiler#633
Conversation
|
Thanks @suncho! I really like that this fix is small, simple and targeted. |
|
I recommend not depending on undocumented implementation details of the MSFT STL: they are subject to frequent changes without notice. |
|
@CaseyCarter: is there a documented/supported way that is broadly equivalent? |
|
@CaseyCarter I looked for a documented way to tag an iterator as checked for Microsoft STL, but I couldn't find one. If there is a documented alternative, we should by all means use that instead. If this implementation detail of the Microsoft STL changes, the only thing that's likely to happen here is that the warning will come back. It shouldn't break anything in the |
Not really. Obviously In fairness to the solution, we conventionally define macros using all uppercase so even if we do change the meaning of Another internal implementation detail that you should TOTALLY NOT depend on: range-based-for looks for |
This addresses issue #621 in a more general way than pull request #622. By adding
_Unchecked_typetospan_iterator, the Microsoft standard library will assume thatspan_iteratoris checked, which it is.Pull request #622 wraps the
span_iteratorin achecked_array_iterator, which is redundant becausespan_iteratoris already checked. Furthermore, #622 is only a very specific fix forgsl::copyin particular. The change in this pull request will allow you to usespan_iteratorfor any of the STL algorithms without warning.