dimanche 18 février 2018

std::bind error with "conditional expression of type 'std::_Unforced' is illegal"

std::bind error with "conditional expression of type 'std::_Unforced' is illegal"

Need help on understanding this error

template <typename Func>
            bool IsConfigured(Func &f, const CString& type, const const MESSAGE_TYPE& message) const
            {
                CString strTag, strValue;
                if (f(type, strTag, strValue))  <== error reported here
                {
                    //do something with message and return true/false
                }
                return false;
            };

And calling here

if(IsConfigured(std::bind(&Message::TypeConfigured, object, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), "type1", message))

And

bool Message::TypeConfigured(const CString& strType, CString& strTag, CString& strValue) const
{
    auto it = m_SchemeList.find(strType);
    if (it != m_SchemeList.end())
    {
        strTag = it->second.strTag;
        strValue = it->second.strValue;
        return !strTag.IsEmpty() && !strValue.IsEmpty();
    }
    return false;
}

I am using visual studio 2015 and could not understand what is "conditional expression of type 'std::_Unforced' is illegal" as Message::TypeConfigured returned bool.

Aucun commentaire:

Enregistrer un commentaire