mardi 3 octobre 2017

Why can't I seem to use std::bind with std::regex_match?

I'm trying to use std::regex_match with std::bind so I can pass it to std::remove_if (to use on a vector<string>), but I can't seem to get the bind part to compile.

For example, for a simple function I have called int test(int, int), all these compile fine:

auto func1 = std::bind(test);
auto func2 = std::bind(test, 1);
auto func3 = std::bind(test, 1, 2);

But, this doesn't:

auto func4 = std::bind(std::regex_match);

I thought that maybe it was because regex_match is a template function, so I tried providing template arguments like this:

auto func = std::bind(std::regex_match<std::char_traits<char>, std::allocator<char>, char, std::regex_traits<char>>);

I've given up on this approach for the project I'm working on, but I'm still curious to know why it didn't work?

Aucun commentaire:

Enregistrer un commentaire