13template <
class Entry >
15 enum class MatchType {
21 auto incompatibleLambda = [ ] ( MatchType compatibility ) {
22 return compatibility == MatchType::INCOMPATIBLE;
26 std::vector < std::pair < ext::vector < MatchType >, Entry * > > compatibilityData;
27 for (
const std::unique_ptr < Entry > & entry : overloads ) {
31 if ( entry->getEntryInfo ( ).getParams ( ).size ( ) != paramTypes.size ( ) )
35 for (
size_t i = 0;
i < paramTypes.size ( ); ++
i ) {
37 if ( std::get < 0 > ( entry->getEntryInfo ( ).getParams ( ) [
i ] ) == paramTypes [
i ] || std::get < 0 > ( entry->getEntryInfo ( ).getParams ( ) [
i ] ) ==
"auto" ) {
38 matchType = MatchType::EXACT;
40 matchType = MatchType::CAST;
42 matchType = MatchType::INCOMPATIBLE;
45 compatibilityVector.push_back ( matchType );
49 if (
std::none_of ( compatibilityVector.
begin ( ), compatibilityVector.
end ( ), incompatibleLambda ) )
50 compatibilityData.emplace_back ( std::move ( compatibilityVector ), entry.get ( ) );
55 for (
size_t i = 0;
i < paramTypes.size ( ); ++
i ) {
58 unsigned overload = 0;
60 if ( data.first [
i ] == MatchType::EXACT )
61 best.insert ( overload );
66 if ( !best.empty ( ) ) {
67 winnerList.push_back ( std::move ( best ) );
73 if ( data.first [
i ] == MatchType::CAST )
74 best.insert ( overload );
79 winnerList.push_back ( std::move ( best ) );
86 std::set_intersection ( winner.begin ( ), winner.end ( ), best.begin ( ), best.end ( ), std::inserter ( filtered, filtered.
end ( ) ) );
87 winner = std::move ( filtered );
91 if ( winner.size ( ) == 1 ) {
92 return compatibilityData [ * winner.begin ( ) ].second->getAbstraction ( );
93 }
else if ( winner.size ( ) > 1 ) {
95 return compatibilityData [ * std::next ( winner.begin ( ) ) ].second->getAbstraction ( );
100 throw std::invalid_argument (
"Entry overload not found" );
AlgorithmCategory
Definition: AlgorithmCategories.hpp:14
static bool castAvailable(const std::string &target, const std::string ¶m, bool implicitOnly)
Definition: CastRegistry.cpp:49
Class extending the list class from the standard library. Original reason is to allow printing of the...
Definition: list.hpp:44
Representation of integer sequence usable in foreach form of for loop.
Definition: foreach.hpp:408
virtual_pointer_to_integer< IntegralType > begin()
Getter of the begin iterator into the sequence.
Definition: foreach.hpp:447
virtual_pointer_to_integer< IntegralType > end()
Getter of the end iterator into the sequence.
Definition: foreach.hpp:457
auto end() &
Inherited behavior of end for non-const instance.
Definition: set.hpp:129
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: vector.hpp:125
auto end() &
Inherited behavior of end for non-const instance.
Definition: vector.hpp:155
Definition: AlgorithmAbstraction.hpp:11
std::shared_ptr< abstraction::OperationAbstraction > getOverload(const ext::list< std::unique_ptr< Entry > > &overloads, const ext::vector< std::string > ¶mTypes, const ext::vector< abstraction::TypeQualifiers::TypeQualifierSet > &, AlgorithmCategories::AlgorithmCategory category)
Definition: OverloadResolution.hpp:14
int i
Definition: AllEpsilonClosure.h:118
none_of(T &&...) -> none_of< T... >