As a learning exercise, I have been looking at how automatic type conversion works in C++. I know that automatic type conversion should generally be avoided, but I'd like to increase my knowledge of C++ by understanding how it works anyway.
I have created a StdStringConverter class that can be automatically converted to a std::string, ...
Hi there,
I've some problems with intel compiler 11.1.xxx
Those problems doesn't appears during compilation with MS CL compiler.
And I don't udnerstand what's wrong with the code (external boost library header)
I end up with multiple errors:
..\boost/log/attributes/attribute_set.hpp(148):
error: declaration is incompatible
...
In C++, do methods only get inlined if they are explicitly declared inline (or defined in a header file), or are compilers allowed to inline methods as they see fit?
...
Shape.h
namespace Graphics {
class Shape {
public:
virtual void Render(Point point) {};
};
}
Rect.h
namespace Graphics {
class Rect : public Shape {
public:
Rect(float x, float y);
Rect();
void setSize(float x, float y);
virtual void Render(Point point);
private:
float sizeX;
float s...
#include <cstdio>
class baseclass
{
};
class derclass : public baseclass
{
public:
derclass(char* str)
{
mystr = str;
}
char* mystr;
};
baseclass* basec;
static void dostuff()
{
basec = (baseclass*)&derclass("wtf");
}
int main()
{
dostuff();
__asm // Added this after the answer found, it makes it fail
{...
I have generated an ATL COM object using VS2008 and the code contains references to a definition called _MERGE_PROXYSTUB (because I chose the 'Merge proxy/stub' option when I initially ran the wizard.)
What is the point of a proxy/stub? If I don't select the the merge option then I get a separate MyControlPS.DLL instead - when would th...
So I have this function used to calculate statistics (min/max/std/mean). Now the thing is this runs generally on a 10,000 by 15,000 matrix. The matrix is stored as a vector<vector<int> > inside the class. Now creating and populating said matrix goes very fast, but when it comes down to the statistics part it becomes so incredibly slow.
...
I want to create a managed C++ unit test project to test an unmanaged MFC project. I have read msujaws's procedural and followed it. I implemented a test method to test the return string of a function like so:
#include "stdafx.h"
#include "TxStats.h"
#include <cstdlib>
#include <atlstr.h>
#pragma managed
#using <mscorlib.dll>
#using <...
Here is a code I would like to get to work:
template <class A>
class B : public A {
public:
// for a given constructor in A, create constructor with identical parameters,
// call constructor of parent class and do some more stuff
B(...) : A(...) {
// do some more stuff
}
};
Is it possible to achieve behavior described by a...
In reality, I am trying to create a control showing price depths of a stock which needs to accept a large number of messages and summarizing them for display purposes. Will I get a better result if I create it in MFC and use that control in my .Net Winform application than writing the whole thing in .NET?
...
Google didn't turn up anything that seemed relevant.
I have a bunch of existing, working C++ code, and I'd like to use python to crawl through it and figure out relationships between classes, etc.
EDIT: Just wanted to point out: I don't think I need or want to parse every bit of C++; I just need something smart enough to pick up on cla...
I am writing simple client-server program.
Client send some messages to server using UDP or TCP. Server must be able to support both UDP and TCP.
If client, sends message using UDP, sequence of method calls in client is socket(),bind(),sendto(),recvfrom(),close() and that in server is socket(),bind(),sendto(),recvfrom(),close().
If it...
I've got an app that has about 10 types of objects. There will be potentially a few thousand object instances of each type. These lists of objects need to stay synchronized between apps running on different machines. If an object is added, changed or deleted, that needs to propagate to the other machines.
This will be a star topology --...
At some point I remember reading that threads can't be safely created until the first line of main(), because compilers insert special code to make threading work that runs during static initialization time. So if you have a global object that creates a thread on construction, your program may crash. But now I can't find the original art...
My "counter" is jumping from 1 to 4 when I enter my loop. Any ideas? Code and output below:
static bool harvestLog()
{
ifstream myFile("LOGS/ex090716.log");
if (myFile.fail()) {cout << "Error opening file";return 1;}
else
{
cout << "File opened... \n";
string line;
string field;
int cs_uri_stemLocation = 0;
int csRefer...
class Foo {
public:
explicit Foo(double item) : x(item) {}
operator double() {return x*2.0;}
private:
double x;
}
double TernaryTest(Foo& item) {
return some_condition ? item : 0;
}
Foo abc(3.05);
double test = TernaryTest(abc);
In the above example, why is test equal to 6 (instead of 6.1) if some_condition is true?
Ch...
Hello, in my application I need to store settings that are 'global' (i.e. not user specific) in a known and predictable location.
I want the application to be able to be run from anywhere (as a standard user, NOT administrator), including multiple copies from different locations and be able to read and write the saved config files.
The...
I'm using the Reprise RLM license manager researching internet activation. I can't figure out how to get the license file from the webserver into a text file with C# (I'm also very new to C#).
RLM comes with an example in C++ but I can't translate it.
My code (for the demo) looks like so:
int stat = RLM.rlm_act_request(handle, "http:/...
I need crossplatform code to skip leading spaces for wide string.
It's looking that g++ (and Qt obviously) doesn't initialize slots for wide string at all
So following code works fine for VC++ but almost g++ fails with bad_cast exception:
#include <string>
#include <locale>
#include <iostream>
int main()
{
typedef std::ctype<std::...
I have a bug on my plate to locate and rewrite a static variable in one of our libraries that is taking up launch time in our application. I am not familiar with the library code base and am asking for good heuristics/techniques/grep commands/etc. that would ease my task in identifying the location of said static variable?
(P.S. I'm alr...