Merge pull request #3666 from bska/dont-copy-vfp-wrapper-tables

Switch to Passing VFP Wrapper Tables as References
This commit is contained in:
Joakim Hove 2021-11-05 10:19:13 +01:00 committed by GitHub
commit 9511f56e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -590,7 +590,7 @@ T getGFR(const VFPProdTable& table,
}
template <typename T>
const T& getTable(const std::map<int, std::reference_wrapper<const T>> tables, int table_id)
const T& getTable(const std::map<int, std::reference_wrapper<const T>>& tables, int table_id)
{
auto entry = tables.find(table_id);
if (entry == tables.end()) {
@ -628,8 +628,8 @@ VFPInjTable::FLO_TYPE getType(const VFPInjTable& table)
return table.getFloType();
}
template const VFPInjTable& getTable<VFPInjTable>(const std::map<int, std::reference_wrapper<const VFPInjTable>>, int);
template const VFPProdTable& getTable<VFPProdTable>(const std::map<int, std::reference_wrapper<const VFPProdTable>>, int);
template const VFPInjTable& getTable<VFPInjTable>(const std::map<int, std::reference_wrapper<const VFPInjTable>>&, int);
template const VFPProdTable& getTable<VFPProdTable>(const std::map<int, std::reference_wrapper<const VFPProdTable>>&, int);
#define INSTANCE(...) \
template __VA_ARGS__ getFlo(const VFPInjTable&, const __VA_ARGS__&, const __VA_ARGS__&, const __VA_ARGS__&); \

View File

@ -149,13 +149,13 @@ VFPEvaluation bhp(const VFPInjTable& table,
* Returns the table from the map if found, or throws an exception
*/
template <typename T>
const T& getTable(const std::map<int, std::reference_wrapper<const T>> tables, int table_id);
const T& getTable(const std::map<int, std::reference_wrapper<const T>>& tables, int table_id);
/**
* Check whether we have a table with the table number
*/
template <typename T>
bool hasTable(const std::map<int, std::reference_wrapper<const T>> tables, int table_id) {
bool hasTable(const std::map<int, std::reference_wrapper<const T>>& tables, int table_id) {
const auto entry = tables.find(table_id);
return (entry != tables.end() );
}