Take a lambda function into use in readwritesplit
To test whether the compiler conforms to C++11, we can try to use a lambda function.
This commit is contained in:
@ -290,14 +290,17 @@ void RWSplitSession::purge_history(mxs::SSessionCommand& sescmd)
|
|||||||
// As the PS handles map to explicit IDs, we must retain all COM_STMT_PREPARE commands
|
// As the PS handles map to explicit IDs, we must retain all COM_STMT_PREPARE commands
|
||||||
if (sescmd->get_command() != MXS_COM_STMT_PREPARE)
|
if (sescmd->get_command() != MXS_COM_STMT_PREPARE)
|
||||||
{
|
{
|
||||||
auto first = std::find_if(m_sescmd_list.begin(), m_sescmd_list.end(),
|
auto eq = [&](mxs::SSessionCommand& scmd)
|
||||||
mxs::equal_pointees(sescmd));
|
{
|
||||||
|
return scmd->eq(*sescmd);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto first = std::find_if(m_sescmd_list.begin(), m_sescmd_list.end(), eq);
|
||||||
|
|
||||||
if (first != m_sescmd_list.end())
|
if (first != m_sescmd_list.end())
|
||||||
{
|
{
|
||||||
// We have at least one of these commands. See if we have a second one
|
// We have at least one of these commands. See if we have a second one
|
||||||
auto second = std::find_if(std::next(first), m_sescmd_list.end(),
|
auto second = std::find_if(std::next(first), m_sescmd_list.end(), eq);
|
||||||
mxs::equal_pointees(sescmd));
|
|
||||||
|
|
||||||
if (second != m_sescmd_list.end())
|
if (second != m_sescmd_list.end())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user