jeudi 30 juin 2016

std::regex with another Allocator

I'm stuck how to use the regex_match template with my own Memory STL Allocator.

This is my code:

FaF::smatch stringResults;
std::regex expression( "expression" );
std::regex_match( std::string-variable, stringResults, expression );

For std::match I was successful and therefore I use it in the above example:

namespace FaF
{
    using smatch = std::match_results<std::string::const_iterator,
                                          Allocator<std::string::const_iterator>>;
}

My Allocator has some logging and I can see clearly, yes it is indeed used. When I understand the cppreference correctly, then std::regex does not have an allocator, but std::regex_match does.

My question:

How to define - according the above types - in the namespace FaF an additional template based on std::regex_match which is using my STL Memory Allocator?

Aucun commentaire:

Enregistrer un commentaire