473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Greta and basic_string<char, ignore_case_traits>

I am trying to convince the Greta regular expression library to use the
following char_traits:

struct ignore_case_traits : std::char_traits<char> {
static bool eq (const char& x, const char& y) {
return tolower (x) == tolower (y);
}
static bool lt (const char& x, const char& y) {
return tolower (x) < tolower (y);
}
static int compare (const char* left, const char* right, size_t n) {
return strnicmp (left, right, n);
}
static const char* find (const char* str, int n, char ch) {
while ((n-- > 0) && (tolower (*str) != tolower (ch)))
++str;
return n >= 0 ? str : 0;
}
};

typedef std::basic_string<char, ignore_case_traits> istring;

I then use the following with Greta:

typedef regex::basic_rpattern<istring::const_iterator> rpattern;

However I am unable to compile the following:

istring istr ("...")
rpattern pat (istr);

The workaround is this:

rpattern pat (istr.c_str());

Any ideas? I have looked into the code and the rpattern constructors
looks like this:

rpattern (const string_type& str, /*various*/...)

And string_type comes from a rather deeply nested typdef in the
basic_rpattern_base_impl class:

typedef std::basic_string<char_type> string_type;

So it looks like rpattern totally ignores any traits I may define. And
since I cannot redefine std::char_traits<char>, which is what
string_type defaults the traits template parameter to, it seems I am
either stuck, or need to define an acceptable char_type substitution.

I guess this is pretty specific huh, sorry if it's OT.
Apr 3 '06 #1
0 1445

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Florian Liefers | last post by:
"Hello World\n", i have the following problem: One of my headerfiles for a lib is including <vector>. When i compile the lib, everything is done well. In my application another file is...
14
by: Dylan Nicholson | last post by:
Been playing around with this all day, and haven't found a solution I like yet. Assuming some initial function: void foo(std::string& src) { src += "some fixed string"; src += bar(); src...
4
by: Jurko Gospodnetić | last post by:
Hi all. I was wondering. Can the standard basic_string<> c_str() member function throw any exceptions? Is it perhaps implementation dependent? I tried checking the standard and as far as I...
8
by: Earl Purple | last post by:
On VC++.NET it is implemented like this static int __cdecl compare ( const _Elem *_First1, const _Elem *_First2, size_t _Count ) { // compare [_First1, _First1 + _Count) with [_First2, ...)...
5
by: Hendrik Schober | last post by:
Hi, I had originally suspected this to be a bug in the std lib, that's why I started a thred in the STL newsgroup. However, it seems as if it is a compiler bug, so I'm transfering it to here....
2
by: ehui928 | last post by:
hi, everybody I am a newbie in STL. When I compile the following program under gcc4.0, I got a the following errors. I wonder whether the form of list< vector<string> > is correct in STL ? //...
1
by: sharmadeep1980 | last post by:
Hi All, I am facing a very unique problem while compling my project in "Release" build. The project is building in DEBUG mode but giving linking error on Release build. Here is the error:...
2
by: Rockair | last post by:
hi! there is a class: class card { static vector<string> names; //... };
3
by: banangroda | last post by:
Compilation fails at "line.insert(line.end(), x.begin(), i);" and I can't figure out why. Here is the code: /* 5-1. Design and implement a program to produce a permuted index. A permuted index...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.