When _GLIBCXX_CONCEPT_CHECKS
is defined, so is this.
#define __glibcxx_function_requires(...) \
__gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >();
So your posted code:
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
Resolves to this:
__gnu_cxx::__function_requires< _InputIteratorConcept<_InputIterator> >();
Which inlines to:
void (_InputIteratorConcept<_InputIterator>::*__x)() _IsUnused = &_InputIteratorConcept<_InputIterator>::__constraints;
This forces an instantiation of _InputIteratorConcept<_InputIterator>::__constraints
, which uses typedef
s to break compilation when _InputIterator
doesn't resemble an iterator.
__glibcxx_requires_valid_range
uses a similar technique to call one of several functions, depending on the iterator type. When appropriate (and fast enough), it will assert that __last
comes after __first