473,385 Members | 1,863 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,385 software developers and data experts.

transform error in g++

jwwicks
19
Hello All,

I'm getting an error in g++ when I try and compile a cpp file using transform...

Here's the error...

customer.cpp:429: error: no matching function for call to transform(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)

The code in question is the following. #include <algorithm> is present and the code compiles no problem under Visual Studio. I know strictly speaking strings aren't containers but shouldn't this work or do you have to do something different for g++. Did MS include an overload that isn't in g++ ??

Expand|Select|Wrap|Line Numbers
  1. void gen_id( customer& c )
  2. {
  3.     string temp;
  4.  
  5.     temp = c.last_name;
  6.     temp += c.first_name.at(0);
  7.     transform( temp.begin(), temp.end(), temp.begin(), toupper);
  8.  
  9.     temp += c.date->get( YEAR );
  10.     c.account = temp;
  11. }
Here's a comment on the problem though I can't get to the FAQ mentioned...

g++ Thread on bug
John
Oct 6 '07 #1
3 2949
weaknessforcats
9,208 Expert Mod 8TB
transform( temp.begin(), temp.end(), temp.begin(), toupper);
This code should work OK.

transform has two overloads. In one the 4th argument is a unary function and in the 2nd it is a binary function.

toupper takes an int argument and returns an int. That quakifies uit as a unary function. Each character of the string will be passed to toupper by transform.

It does concern me that your error message contains __normal_iterator, which is not a standard STL iterator type.

transform expects a string::iterator, which is a normal forward iterator.

I assume you are using the -pedantic switch with g++ to disable non-standard extensions, though I can't see what difference that would make here.
Oct 7 '07 #2
jwwicks
19
This code should work OK.

I assume you are using the -pedantic switch with g++ to disable non-standard extensions, though I can't see what difference that would make here.
I'll try the -pedantic switch to see if it helps...

P.S.
Tested with the -pedantic switch and no difference in errors...
g++ (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)

Thanks,
John
Oct 8 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
Then I havwe no idea. Your tranforms compiles OK using Visual Studio.NET 2005.
Oct 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: Steffen Brinkmann | last post by:
Hi! I tried to modify the transform algorithm in a way that it doesn't take iterators, but a reference to a container class and a value, because Mostly I need to do an operation of a container...
0
by: Xiaolei Li | last post by:
first off, i'm a total newbie at this stuff so excuse any wrong usage of terminology or whatever else. i have a XSL to transform a Document such that all "text" nodes will have a "SPAN" inserted...
6
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
9
by: Doug Stiers | last post by:
I have this vb.net (framework 1.1) code: Dim x As Xml.Xsl.XslTransform = New Xml.Xsl.XslTransform Dim xr As XmlResolver MessageBox.Show("before load") x.Load(<xsl file name>) -- THIS IS WHERE...
1
by: Steve | last post by:
Using VB.NET 2.0 I have a simple routine that attempts transforms an XmlDocument with an XSLT stylesheet into HTML. Under the old 1.1 framework with XslTransform, everything worked fine. Now...
3
by: BrianDH | last post by:
Hi I am having a problem doing the tranform. Unlike all the examples I have found, I do not load my XML document via a path but from a datacall. I get erros when I try to do the transform...
0
by: K. Wilder | last post by:
I'm having a problem getting this to work in ASP.NET 2.0. I'm trying to prevent the validation of a DTD in the incoming XML. I have this XML that I receive via xml web service from an external...
2
by: Donald Adams | last post by:
I'm creating Word 2007 reports in asp.net 1.1 via xml transform. I get data from the SQL server in .5 sec., first transform takes less than a sec. and uses 10MB. I have 900MB free memory of the...
0
by: nkumar | last post by:
Hello All, I need to implement a Custom Security Transform by Inheriting Transform class for signing the MIME. While computing signature using WSE 3.0, .NET won't throw any error. But while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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...

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.