I was reading wikipedia on C/C++ Prototype statements and I'm confused:
Wikipedia say: "By including the function prototype, you inform the compiler that the function "fac" takes one integer argument and you enable the compiler to catch these kinds of errors."
and uses the below as an example:
#include <stdio.h>
/*
* If this prot...
Please:
There are no leaked handles [1]. The file is not open by anything in our software (it could be held open by an AntiVirus or a system indexing service, etc.) The code below can be compiled and run on your computer at home/office: you can see instantly that this loop fails and by itself NEVER attempts the Delete until after ALL h...
Hello all, I think I've run into a (possible) VC6 (I know. It's what we use.) compiler error, but am open to the fact that I've just missed something dumb. Given the following code (It's just an example!):
#include <iostream>
// Class with template member function:
class SomeClass
{
public:
SomeClass() {};
template<class T>
T ge...
Hello!
That's pretty much my question: can VS 2010 check and update header files in C++ code automatically? And can VS 2010 automatically generate a cpp file from a header file, saving you the time to copy the function definitions from the header file? I mean, can it figure that there's no implementation for some method and generate an ...
I've got a function that returns a std::string object. I'm working with Cocoa/CoreGraphics and I need a way to get the data from that string into a CFData object so that I can feed that into a CGDataProviderCreateWithCFData object to make a CGImage.
The CreateCFData function wants a const UInt8* object (UInt8 being a typedef for unsign...
I want to read each line of txt file which resembles something like this
1190/2132 123/23123 45
I want to read the whole line and then store them in three separate strings for future use to build a tree . I am using fgets right now , but getting errors regarding putting it into a string . How should i do it ?
...
I'd like to create a "single assignment" wrapper for basic types (such as int) that talks like an int, walks like an int, smells like an int, but can only be modified or assigned to at most once (like in some pure functional languages). For example (copy constructor omitted to keep the example simple):
template<class T>
struct SA {
...
Hi,
I have a question which is in some way, I guess, completely trivial: what's that (and why)?
const float *(*const*)(int)
My understanding is that it is a "pointer to a constant pointer to a function taking an int as argument and returning a pointer to constant float".
Is it correct ?
How to "mentally parse" (*const*) ? Especiall...
Hi
I have 2 classes which represent a matrix:
1. RegularMatrix - O(n^2) representation
2. SparseMatrix - a matrix that is represented as linked list (without zeros).
lets say i have:
RegularMatrix a;
SparseMatrix b;
i want to be able to do:
a+b;
and also:
b+a;
so i'm overloading the + operator. My question is, since I want th...
Hello!
Is there any way to make static libraries built in Microsoft Visual Studio independent from used CRT (with debug support / without it)?
I mean like, for simple C library it is possible to generate code using gcc and then use the same static library in visual studio. The resulting library.a file is completely independent from /MT...
I would like to write a "versatile" class representing the general container storing pointers. Should I use public inheritance or containment?
template <class T>
class List : public std::vector <T *>
{
//...
}
Or
template <class T>
class List
{
private:
std::vector <T *> items;
//...
}
May some problems occur with abstract class...
Hello guys,
I'm currently being forced to work with Eclipse on one of my current projects. The language we're working with is C++.
The one thing I miss the most from Visual Studio is VisualAssistX, mostly for its Auto Complete.
Is there anything like it for Eclipse? Or is there anyway to buff Eclipse's autocompletion?
Thanks a lot, p...
I have a C++ application that executes test cases. It is possible that some test cases will depend on output from other test cases.
All test cases implement a basic interface:
/// base class for all test cases
class ITest
{
public:
virtual void Execute() = 0;
};
Test cases that produce some object that may be useful to other tes...
I'm trying to wrap triggering for a boost::signal into a boost::bind object. So what I want is to invoke the signal with some pre-packaged arguments when the boost::function is called.
What I have is this:
boost::signals2::signal<void(int)> sig;
boost::function<void()> f = boost::bind(
&(sig.operator()), &sig, 10);
But this doesn...
I did some testing with C++ hypot() and Java Math.hypot. They both seem to be significantly slower than sqrt(a*a + b*b). Is that because of a better precision? What method to calculate a hypotenuse hypot function uses? Surprisingly I couldn't find any indication of poor performance in the documentation.
...
Possible Duplicate:
Reading through file using ifstream
Hello. I'm a bit of a newbie to C++ so please be specific. I'm trying to find a way to read something from a file, put it into a string and then output it onto the screen. If you know how to do this can you give an example? Thanks.
...
I have two classes: an Object class, and an ObjectManager class. The ObjectManager class stores "Objects" via a ptr_vector container. There are some instances where I need to retrieve references to these stored pointers to perform individual actions on them. How would I go about doing so?
Compilable Pseudo Code:
#include <boost/ptr_con...
I am confused on how the boost::compressed_matrix works. Suppose I declare the compressed_matrix like this:
boost::numeric::ublas::compressed_matrix<double> T(1000, 1000, 3*1000);
This allocates space for 3*1000 elements in a 1000x1000 matrix. Now how do I give it the locations which are the non-zero elements? When and how are the non...
Having an issue with a client web page where all of the IE features are made inaccessible, I don't use IE much. The web page launches another window to show a pdf and generally fails at doing so - window displays only once, subsequent attempts flashes briefly before closing, and sometimes GPFs.
Because the toolbar/menu/context menu are...
Hi,
For dissecting/understanding huge template-heavy code base it would really useful to have a tool that tells me what class/code have made it to the final binary.
For example if there are two class A and B in the code but I only end up instantiating only A then I would somehow like to know filter out B. Are there any tools to achieve...