Jump to content
  • Advertisement
Sign in to follow this  
supagu

yet another gcc compile problem

This topic is 4059 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have another problem porting visual studio code to gcc: std::transform(name.begin(), name.end(), name.begin(), std::tolower); doesnt compile, i get the following error: /home/bronson/workspace/Project/AirBlimbs/Source/Entity/PhysicsModel.cpp:83: error: no matching function for call to ‘transform(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)’ i suspect its complianing about the std::tolower part

Share this post


Link to post
Share on other sites
Advertisement
std::tolower is a template function, you need to specify the template paramaters because gcc is unable to infer them from the context as the paramater is to transform is also a template.

Example:

void foo(char (*tolowerfunc)(char))
{
}

template<typename T>
void bar(T tolowerfunc)
{
}

int main()
{
// The standard dictates that this should infer the template paramater for
// std::tolower as being char from the type of the thing being initialized
foo(std::tolower);

// However there is no contextual information here to infer the template
// parameter for std::tolower so you get ambiguity errors/unresolved
// overload errors if you don't include the template parameters
bar(std::tolower<char>);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!