GRETA库在VS 2005环境下的编译经验

作者:朱金灿

来源:blog.csdn.net/clever101

 

      GRETA是微软研究院推出的一个正则表达式模板类库,GRETA 包含的 C++ 对象和函数,使字符串的模式匹配和替换变得很容易,它们是:

·   " rpattern: 搜索的模式

·   " match_results/subst_results: 放置匹配、替换结果的容器

 

 

     据测试,GRETA库的匹配速度比Boost RegexATL7CATLRegExp都快。另外GRETA虽说是微软研究院出的,在linux其实也可以用的。

 

     GRETA库原在vc6下发布的。用VS 2005编译,会报错:

 

具体错误参照:

social.microsoft.com/Forums/zh-TW/vcgeneral/thread/7461e68d-739d-4b36-a068-1c12a827e594 ,“Greta Parser for VS2005,就是:

 

'regex::hetero_stack<AlignmentT,RuntimeTypeCheckT,AssumePodT,DynamicBlockSizeT,StaticBlockSizeT>:tack_node::header' : dependent name is not a type

 

解决办法:在模板定义的tack_node前面加上struct即可。

 

具体就是在下面代码行:

byte_t m_buf[ aligned_sizeof<stack_node::header>::no_rtti + StaticBlockSizeT ];

 

修改为:

 

byte_t m_buf[ aligned_sizeof<struct stack_node::header>::no_rtti + StaticBlockSizeT ];

 

 

       基于VS 2005的源码工程(一个Win 32静态库工程)可以在此下载:

greta for VS2005

 

原文地址:https://www.cnblogs.com/lanzhi/p/6471130.html