Auto seems to have some sort of limitations

    auto regex_p = new std::tr1::regex("foo", flags);

"/u/xxxxxx/FEB2018/Source/SANDBOX.C", line 27.20: CCN5257 (S) An object or 
reference of type "int" cannot be            
initialized with an expression of type 
"std::tr1::_EBCDIC::basic_regex<char,std::tr1::_EBCDIC::regex_traits<char> > *".

z/OS V2R2


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Monday, April 9, 2018 9:33 AM
Subject: Re: Any C++ regex template class gotchas?

On 9/04/2018 7:55 PM, Charles Mills wrote:
> David -
> Thanks for everything. I guess I will PMR it. As pointed out in another 
> thread, the PMR process is painful. It does me little good because I can't 
> ship a product that requires some obscure PTF -- the sales team would kill me.

I feel your pain.

> Nah, the tr1 doesn't bother me. It's like having to code those pesky 
> semicolons or those pesky double equal signs. It is what it is. My Visual 
> Studio accepts but does not require the tr1:: for regex. I use Visual Assist 
> and it tends to autocomplete these things for me anyway, so it is little 
> trouble.
> I used namespace when I started out in C++ but then decided I was collapsing 
> the name space. I would rather have to code std:: every time than to have 
> some weird problem caused by an unexpected symbol name duplication.

Me too. I avoid usings like "using namespace std". The using I posted brings 
the tr1 namespace into std so I can use std::regex and not std::tr1::regex. I 
don't use visual studio and clang and g++ require including special headers 
like <tr1/regex> which I would rather not do.

> I use auto sometimes but tend not to think to use it except in template 
> functions and that sort of thing.

auto has moved on significantly since C++14 and C++17 and you can now define a 
function with an auto return value. It's also important for lambda's. 
Especially useful for iterators so you don't have to code something like 
std::unsorted_map<int, std::string>::iterator or use typedefs.

For IBM-MAIN subscribe / signoff / archive access instructions,
send email to with the message: INFO IBM-MAIN

Reply via email to