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.

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.

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


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


Do you get fed up with having to specify the pesky tr1 namespace? It makes it 
difficult to share code between z/OS and distributed. You can work around that 
with a useful namespace declaration.
Also, if you are using LANGLVL(EXTENDED0X) you can significantly cut down on 
the verbosity of variable definitions by using auto type inference.

#include <cstdio> // bring C stdio runtime into the std namespace

#define __IBMCPP_TR1__ 1
#include <regex>

namespace std { using namespace tr1; }  // be gone pesky tr1 namespace

struct myRegex
     std::regex regexObject;

int main(int argc, char* argv[])
     printf("RegEx test 4/6/2018\n");
     auto flags = std::regex::extended;     // necessary for error
     auto *myRegex_p = new myRegex;
     myRegex_p->regexObject.assign("foo", flags);
     delete myRegex_p;
     return 0;

On 9/04/2018 2:09 AM, Charles Mills wrote:
> Believe it or not, it appears to be a bug in the C++ runtime. Anyone 
> who wants to prove me wrong is welcome to try the below. I have tested 
> only on z/OS V2R2.
> #include <stdio.h>
> #define __IBMCPP_TR1__ 1
> #include <regex>
> class myRegex
> {
> public:
>      std::tr1::regex regexObject;
> };

For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to