MCPcopy Create free account
hub / github.com/SpartanJ/eepp / findIndex

Method findIndex

src/eepp/ui/doc/textrange.cpp:279–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279size_t TextRanges::findIndex( const TextRange& range ) const {
280 if ( !mIsSorted ) {
281 auto it = std::find( begin(), end(), range );
282 return it != end() ? std::distance( begin(), it ) : static_cast<size_t>( -1 );
283 } else {
284 auto it = std::lower_bound( begin(), end(), range );
285 return ( it != end() && *it == range ) ? std::distance( begin(), it )
286 : static_cast<size_t>( -1 );
287 }
288}
289
290bool TextRanges::hasSelection() const {
291 for ( const auto& r : *this )

Callers 3

addSelectionsMethod · 0.80
addSelectionMethod · 0.80
selectionIndexMethod · 0.80

Calls 4

findFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
distanceFunction · 0.85

Tested by

no test coverage detected