Featured post
c++ - How to save/serialize compiled regular expression (std::regex) to a file? -
i'm using <regex>
visal studio 2010. understand when create regex object it's compiled. there no compile method in other languages , libraries thinks that's how work, right?
i need store large amount of compiled regexes in file chunk of memory block , compiled regex.
i can't figure how this. found in pcre possible it's linux library. there windows [version2 it's 3 years old , use more high-level approach (there isn't c++ wrapper in windows version).
so possible use save std:regex
or boost::regex
(it's same right?) chunk of memory , reuse later?
or there other simple library windows allows this?
edit: great answers. i'll check if sufficient store regex string , if still slow i'll test , compare old pcre library.
i don't think can done without modifying boost library support it.
i don't know how boost regex library implemented, regex libraries compile things binary blob that's interpreted later series of instructions sort of limited virtual machine.
if boost's regex library implemented in way, serializing relatively easy. @ binary blob somehow , dump disk. existence of posix regex api boost library tells me how it's implemented.
otoh, way implement (and not common way) generating abstract syntax tree regex. means individual pieces of regex represented own objects , objects linked larger structure represented whole regex.
if boost way serialization complex.
this not possible c++, wish happened boost compile constant string regular expressions @ compile time template meta-programming. reason not possible isn't possible iterate on contents of string (even constant string) template.
- Get link
- X
- Other Apps
Comments
Post a Comment