Skip to content

Commit 3a72636

Browse files
Fix up ambuguous overload due to an overridden method.
1 parent 8322de8 commit 3a72636

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

RESTProcess_base.h

+18-2
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,31 @@ namespace classdesc
371371
else
372372
{
373373
if (auto functions=dynamic_cast<RESTProcessOverloadedFunction*>(i->second.get()))
374-
functions->overloadedFunctions.emplace_back(rp);
374+
{
375+
// replace if signature the same
376+
for (auto& f: functions->overloadedFunctions)
377+
if (f->signature()==rp->signature())
378+
{
379+
i->second.reset(rp);
380+
return;
381+
}
382+
functions->overloadedFunctions.emplace_back(rp);
383+
}
375384
else
376385
{
377386
auto firstFunction=dynamic_pointer_cast<RESTProcessFunctionBase>(i->second);
387+
// replace if signature the same
388+
if (firstFunction->signature()==rp->signature())
389+
{
390+
i->second.reset(rp);
391+
return;
392+
}
378393
auto functs=std::make_shared<RESTProcessOverloadedFunction>();
379394
if (firstFunction) functs->overloadedFunctions.push_back(std::move(firstFunction));
380395
functs->overloadedFunctions.emplace_back(rp);
381396
i->second=functs;
382397
}
398+
383399
}
384400
}
385401

@@ -1258,7 +1274,7 @@ namespace classdesc
12581274
//template <class T> bool partiallyMatchable(const json5_parser::mValue& x);
12591275

12601276
template <class T>
1261-
typename enable_if<is_floating_point<typename remove_reference<T>::type>, bool>::T partiallyMatchable(const REST_PROCESS_BUFFER& x)
1277+
typename enable_if<is_floating_point<T>, bool>::T partiallyMatchable(const REST_PROCESS_BUFFER& x)
12621278
{return x.type()==RESTProcessType::float_number||x.type()==RESTProcessType::int_number;}
12631279

12641280
template <class T>

signature.h

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace classdesc
1818
{
1919
std::string ret;
2020
std::vector<std::string> args;
21+
bool operator==(const Signature& s) const {return args==s.args;}
2122
};
2223
}
2324

0 commit comments

Comments
 (0)