草庐IT

regex_token_iterator

全部标签

c++ - ‘*’ token 之前的预期初始值设定项

我正在尝试实现设计模式书中的代码。我收到以下错误:expectedinitializerbefore‘*’token对于这一行:staticSingleton*Singleton::itsInstance=0;这是完整的代码。我正在使用g++4.2.1来尝试编译它。classSingleton{public:staticSingleton*instance();protected:Singleton();private:staticSingleton*itsInstance;}staticSingleton*Singleton::itsInstance=0;Singleton*Sing

c++ - "vector iterator + offset out of range"断言有用吗?

这个完美的程序在VisualStudio2013的Debug模式下失败:#include#include#includeusingnamespacestd;voidmain(){vectorv={3,1,4,1,5,9,2,6,5,3};for(autoiFrom=v.cbegin(),iTo=iFrom+5;iFrom!=v.cend();iFrom=iTo,iTo+=5)coutvectoriterator+offsetoutofrange断言失败。它失败是因为iTo>v.cend(),这在这里是无害的。调试器测试没有被取消引用的迭代器的值有什么意义?顺便说一句,我知道我可以将上面

C++:std::istream 检查 EOF 而不读取/消耗 token /使用运算符>>

我想测试std::istream是否已经到达结尾而不读取它。我知道我可以像这样检查EOF:if(is>>something)但这有一系列的问题。想象有许多(可能是虚拟的)方法/函数期望std::istream&作为参数传递。这意味着我必须做一些检查EOF的“家务”,可能使用不同类型的something变量,或者创建一些奇怪的包装器来处理调用输入法的情况.我需要做的就是:if(!IsEof(is))Input(is);IsEof方法应保证流不会因读取而改变,因此上面的行等同于:Input(is)关于在Input方法中读取的数据。如果没有通用的解决方案来表示和std::istream,有没

c++ - C++ : "expected primary-expression before ‘>’ token"中的两个模板

这个问题在这里已经有了答案:WhereandwhydoIhavetoputthe"template"and"typename"keywords?(8个答案)关闭7年前。最小工作示例:#includestructPrinter{templatestaticvoidprint(Telem){std::coutstructMain{templatevoidprint(Telem){//Inthiscase,thecompilercouldguessTfromthecontext//Butinmycase,assumethatIneedtospecifyT.printer_t::print(e

C++ regex_match 不工作

这是我的部分代码boolCSettings::bParseLine(constchar*input){//_asmINT3std::stringline(input);std::size_tposition=std::string::npos,comment;regexcvarPattern("\\.([a-zA-Z_]+)");regexparentPattern("^([a-zA-Z0-9_]+)\\.");regexcvarValue("\\.[a-zA-Z0-9_]+[]*=[]*(\\d+\\.*\\d*)");std::cmatchmatchedParent,matched

c++ - 为什么我的 Boost.Regex 搜索只报告一次匹配迭代?

我试图找出一个字符串中有多少个正则表达式匹配项。我正在使用迭代器来迭代匹配项,并使用整数来记录有多少匹配项。longintbefore=GetTickCount();stringtext;boost::regexre("^(\\d{5})\\s(\\d{8})\\s(.*)\\s(.*)\\s(.*)\\s(\\d{8})\\s(.{1})$");char*buffer;longlength;longcount;ifstreamf;f.open("c:\\temp\\test.txt",ios::in|ios::ate);length=f.tellg();f.seekg(0,ios::

c++ - C++ 代码错误 "expected constructor, destructor, or type conversion before ‘(’ token ”和 "no matching function for call to ..."

真正尝试解决错误,仔细检查所有内容。请帮忙。c++新手,请多关照。头文件(.h)#ifndefGUARD_Optimized_quick_sort_h#defineGUARD_Optimized_quick_sort_h#include#include#includeusingnamespacestd;templateclassoptimized_quick_sort{public:optimized_quick_sort(vectorarray){this->array=array;}optimized_quick_sort(listarray){vectortemp(array.b

C++ 模板 - 错误 : expected initializer before '<' token

我正在尝试学习模板,我希望我的类对能够容纳两个任何类型的对象。我现在只想为obj1提供一个访问器函数。但是当我尝试编译时出现以下错误:error:expectedinitializerbefore'::getObj1()我的代码是:#include#include#includeusingnamespacestd;templateclasspair{public:pair(constT1&t1,constT2&t2):obj1(t1),obj2(t2){};T1getObj1();private:T1obj1;T2obj2;};templateT1pair::getObj1(){ret

c++ - 自定义双向迭代器的 reverse_iterator 上的 for_each 需要 OutputIterator

我创建了一个简单的不可变双向迭代器:#include#include#include#include#includeclassmy_iterator:publicstd::iterator{intd_val;public:my_iterator():d_val(0){}my_iterator(intval):d_val(val){}my_iteratoroperator--(int){d_val--;returnmy_iterator(d_val+1);}my_iterator&operator--(){d_val--;return*this;}my_iteratoroperator+

023-安全开发-PHP应用&后台模&Session&Cookie&Token&身份验证&唯一性

023-安全开发-PHP应用&后台模&Session&Cookie&Token&身份验证&唯一性#知识点:1、PHP后台身份验证模块实现2、Cookie&Session技术&差异3、Token数据包唯一性应用场景项目1:用cookie做后台身份验证项目2:用session做后台身份验证项目3:用token做用户登录判断演示案例:➢后台模块-身份验证-Cookie技术➢后台模块-身份验证-Seesion技术➢后台及其他-数据唯一性-Token技术#身份验证-Cookie使用生成cookie的原理图过程:见图1、客户端向服务器发送HTTP请求。2、服务器检查请求头中是否包含cookie信息。3、如