473,385 Members | 2,005 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.

Conversion function error

I have a template class called Image and I want to make a
conversion function to that I can easily convert one
template type to another. I tried making functions for a
couple specific cases, but I get an error that says it
will cause a stack overflow. I don't think my function
should do that, so maybe I did something wrong. Here is
the function in question (I have it defined in the class
declaration in the header file).

operator Image<float>()
{
Image<float> newImage(*this, false);
Image<float>::iterator iterNew = newImage.begin();
for(iterator iter = begin(); !iter.end(); ++iter,
++iterNew) {
*iterNew = float(*iter); }
return newImage;
}
Here is the exact error:

image.h(78) : warning
C4717: 'ImageNS::Image<double>::operator
ImageNS::Image<float>' : recursive on all control paths,
function will cause runtime stack overflow

I'm pretty sure this function is not recursive, it
shoudldn't be. Is this my fault or a problem with visual
studio .net 2003?

Thanks,
Chris
Nov 16 '05 #1
0 942

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

Similar topics

9
by: Ronald Fischer | last post by:
Assume the following JavaScript function: function bracketize(s) { return ''; } This function which doesn't assume anything about its argument except that it must be convertible to a string.
5
by: john | last post by:
Here is the short story of what i'm trying to do. I have a 4 sided case labeling printer setting out on one of our production lines. Now then i have a vb.net application that sends data to this...
1
by: Trisha Schneider | last post by:
I'm trying to convert a database from A97 to A2000. I made a copy of my database and then attempted the conversion. During the conversion, I get this message: "There were compilation errors...
1
by: jason | last post by:
i'm working on a gradual conversion of an ASP classic web site to ASP.NET. a recent body of work involves adding a new asp page to the existing site. i thought this would be a good opportunity to...
6
by: Dhirendra Singh | last post by:
Hi, The following C++ program is not compiling on my system. #include <iostream> using namespace std; class complex { double re, im; public: complex( ) :re(0), im(0) {}
11
by: jyck91 | last post by:
// Base Conversion // Aim: This program is to convert an inputted number // from base M into base N. Display the converted // number in base N. #include <stdio.h> #include <stdlib.h>...
0
by: =?Utf-8?B?RGVuaXMgU29oZXQ=?= | last post by:
Hi all, I've created a new project to test ObjectDataSource component. I've just added a new objectdatasource, configured it (linked to a table) etc ... It works fine on localhost, i can...
3
by: fazulu deen | last post by:
Hi all, For the following code : file_ptr = fopen("pass_fail.txt", "a"); // error line 393 fdisplay(file_ptr, "Test Passed"); fclose(file_ptr);
6
by: Rahul | last post by:
Hi Everyone, I have the following code, class B; class A { public : operator B();
1
by: =?Utf-8?B?TWlrZSBN?= | last post by:
Hi, My conversion seems from VB6 to VB.Net of an interface to an API seem to have gone OK, but when I look at the output from the Debug.Print("Active server is " & xmlServerActive) statement,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.