473,569 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

complex <double> as return type or parameter

Hi,
I m a having problem while trying to make the return type of a method
in MFC appl in VC6 as complex<double> . If i declear a variable wth
std::complex<do uble> type, it is compled successfully. But when i use
it as a return type, it gives compilation errors. Please help me out...

Apr 9 '06 #1
2 2408
mh****@gmail.co m wrote:
Hi,
I m a having problem while trying to make the return type of a method
in MFC appl in VC6 as complex<double> . If i declear a variable wth
std::complex<do uble> type, it is compled successfully. But when i use
it as a return type, it gives compilation errors.
Are we supposed to guess what the errors are, or how the code looks? You
know, crystal balls are expensive these days, and their quality is bad.
They need lots of repairs.
Please help me out...


You need to provide more information about your problem.

Apr 9 '06 #2
<mh****@gmail.c om> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com
Hi,
I m a having problem while trying to make the return type of a method
in MFC appl in VC6 as complex<double> . If i declear a variable wth
std::complex<do uble> type, it is compled successfully. But when i use
it as a return type, it gives compilation errors. Please help me
out...


What are the compilation errors. We are not psychics. The following compiles
fine for me with VC++6:

#include <complex>

std::complex<do uble> foo()
{
std::complex<do uble> c(1,1);
return c;
}
int main()
{
std::complex<do uble> cd = foo();
return 0;
}
--
John Carson
Apr 9 '06 #3

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

Similar topics

14
2647
by: LumisROB | last post by:
Is it possible to create matrixes with vector <vector <double >> ? If it is possible which is the element m23 ? You excuse but I am not an expert Thanks ROB
9
3420
by: Greg Buchholz | last post by:
/* While writing a C++ version of the Mandelbrot benchmark over at the "The Great Computer Language Shootout"... http://shootout.alioth.debian.org/gp4/benchmark.php?test=mandelbrot&lang=all ....I've come across the issue that complex<double>'s seem quite slow unless compiled with -ffast-math. Of course doing that results in incorrect...
3
13925
by: Web learner | last post by:
The following code works fine private List<double> GetDataFor(string column, int selectedYear) { ------- ------- return list; } foreach (double item in GetDataFor("AirTemp", selectedYear)) { Response.Write(item.ToString() + ", ");
2
2811
by: PengYu.UT | last post by:
Hi, In FFTW (http://www.fftw.org/), it defines the funciton fftw_malloc to allocate memory properly aligned. However, I only want to use new to allocate memory for std::complex<double>. Can some body show me how to redefine the new operator for an class already defined in the library? Thanks,
3
6145
by: J.M. | last post by:
I have data in a double array of length 2N, which actually represents complex numbers with real and imaginary parts interlaced. In other words, elements in this array with even indices represents the real part of a complex number, elements with odd indices represent the imaginary part. I actually need an array of length N of type...
1
9414
by: perroe | last post by:
Hi I have a array of complex numbers that are stored in a simple double array. This is done since the array is part of an wrapper for an external C library, and the imaginary part of the first element, and the last element are known to be 0. I've implemented a -operator that returns a ComplexReference object that basically maps a...
32
3969
by: T. Crane | last post by:
Hi, I'm struggling with how to initialize a vector<vector<double>> object. I'm pulling data out of a file and storing it in the vector<vector<double>object. Because any given file will have a large amount of data, that I read off using an ifstream object, I don't want to use the push_back method because this grows the...
5
6041
by: jeremit0 | last post by:
I'm trying to sort a vector<complex<double and can't figure it out. I recognize the problem is that there isn't a default operator< for complex data types. I have written my own operator and can use it, but std::sort doesn't seem to find it. I have copied a very simple example below. Everything compiles just fine when the line with...
3
2572
by: huili80 | last post by:
Like in the following. Though it gives the expected result with gcc4.0, is it really safe to do that? What if it's not double but some non-POD type? ----------------------------------------- #include <complex> #include <iostream> #include <iterator> int main()
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6286
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.