I’m using ubuntu 12.04 – 64 bits. I tested it with boost 1.46, 1.48, 1.52 and
gcc 4.4 and 4.6
When I try to compile:
while (m_burstReqBeatsRemain) {
if (m_burstReqAddress % m_dramRowSize == 0) {
m_admRequestQueue.push_back(adm_request());
adm_request &req = m_admRequestQueue.back();
req.address = m_burstReqAddress;
req.command = tlm::TLM_READ_COMMAND;
//call to min function
req.readLen = std::min(m_burstReqBeatsRemain * sizeof(Td), m_dramRowSize);
}
m_burstReqBeatsRemain--;
m_burstReqAddress += sizeof(Td);
m_ocpTxnQueue.push_back(m_ocpReq);
}
I get this error:
no matching function for call to ‘min(long unsigned int&, unsigned int&)
from /usr/include/c++/4.6/bits/stl_algobase.h*
Note: with ubuntu 12.04 32 bits works fine
Any idea how I can fix this?
std::minis a function template onTwhich is the type of both parameters of the function. But you seem to pass function arguments of different type, and rely on template argument deduction from function arguments, which is not possible.So the fix is :
Either don’t rely on template argument deduction, instead explicitly mention the template argument:
Or pass function arguments of same type: