Closed AlCash07 closed 7 years ago
Can you provide an example where even /// caide keep
doesn't help?
Looks like I was trying to write the comment on the same line, while it should go before. Anyway, here's an example where type alias is removed, which changes the output from 1
to 0
: http://ideone.com/74nIGF
This is fixed now. However, there is a caveat specifically for iterator_category
and similar cases.
For instance, a custom iterator passed to std::shuffle
must satisfy RandomAccessIterator concept,
which means that it must provide a certain number of member functions/type aliases.
However, there is no way to detect this requirement, unless both the language and
the standard library have full concept support (which we don't want to rely on).
That's because some of the functions/type aliases required by the concept might
not actually be used by a particular STL implementation. If we remove them, the
program becomes technically illegal and may not even compile in another compiler.
To work around that, it's possible to mark declarations required by some Concept
with a comment /// caide concept
. This will ensure these declarations don't get
removed as long as the class containing them is used.
using iterator_category = std::input_iterator_tag;
Type aliases like this one inside my iterator classes are removed even with the// caide keep
comment.