So far, so good. However, a few issues have arisen.
First and foremost, is that when I call the following:
const bool bppExists = CheckMapForExistingEntry< std::string, int >( mConfigValues, "bpp" );
I get the following:
error: undefined reference to `bool CheckMapForExistingEntry<std::string, int>(std::map<std::string, int, std::less<std::string>, std::allocator<std::pair<std::string const, int> > > const&, std::string const&)'
There are three other instances of where this is happening. The function looks as follows:
Declaration
template < class Key, class Value >
bool CheckMapForExistingEntry( const std::map< Key, Value >& map, const std::string& key );
Definition
template < class Key, class Value >
bool CheckMapForExistingEntry( const std::map< Key, Value >& map, const std::string& key )
{
typename std::map< Key, Value >::iterator it = map.lower_bound( key );
bool keyExists = ( it != map.end && !( map.key_comp() ( key, it->first ) ) );
if ( keyExists )
{
return true;
}
return false;
}
Thus, what is happening here? I have the header file included which contains the declaration of the function, and yet it still doesn't work. According to this, I'm supposed to leave out the value of the template argument and just pass the key_type
, however that refuses to work as well.
For example:
CheckMapForExistingEntry< std::string >( someMap, "somekey" ); //error