I'm implementing the shunting-yard algorithm. I'm having trouble detecting when there are missing arguments to operators. The wikipedia entry is very bad on this topic, and their code also crashes for the example below.
For instance 3 - (5 + ) is incorrect because the + is missing an argument.
Just before the algorithm reaches the ), t...
I have a wstring stream that I'm using as sort of a buffer in my class and it is used by a good portion of the methods in this class. However, when I try to do something like this:
#include <sstream>
class foo
{
public:
void methodA(int x, int y); // Uses mBufferStream
void methodB(int x, int y); // Uses mBufferStream
pri...
Hello,
I think the title says pretty much everything, hehe. I would like you to tell me when to use std::istringstream, std::ostringstream and std::stringstream and why I shouldn't just use std::stringstream in every scenario (like are there any runtime performance issues?).
Thanks!
PS: I have a third, less important question. Is ther...
I'm going to outline my problem in detail to explain what I'm trying to achieve, the question is in the last paragraph if you wish to ignore the details of my problem.
I have a problem with a class design in which I wish to pass a value of any type into push() and pop() functions which will convert the value passed into a string represe...
I'm writing a tracing library that is available as a DLL. It is consumed by basically every component in my system. One tricky requirement is that the tracing functions need to be invoked very early in the process lifetime, even before main() runs.
Consumers of this library include executables, statically linked DLLs, delay-loaded DLL...
I have found a solution for this, but it only works if you use .DEF files (I don't).
I wonder if this can be done without .DEF files.
...
I understand that the default max buffer size I can use with these functions is 65507 (5535 - IPv4 header - UDP header). However, is there a way to change this? I need to be able send a larger buffer ~66000 bytes. I tried using the setsockopt() function, but it didn't seem to work.
Thanks!
...
Hi, I have made a C++ win32 console application in VS 2008. I open an image in a window. I want to achieve the same result by clicking a button on a form and the image appearing in a picturebox for instance pictureBox1.
So, I made a C++ windows form project and pasted this code in the public area, and it gave me a heap of errors. Do I ...
Don't understand, where do I get this wrong. If compiled without openmp support, the code works correctly. But with openmp variables seem to get wrong visibility.
I had the following intention. Each thread has its own max_private in which it finds the local maximum. Then a global maximum is found in a critical section.
#include <iostre...
Hi,
I need to call a function (an LLVM JIT to be specific) from a C++ application. This call might fail or even signal abort() or exit(). How can I avoid or at least reduce effects on my host application? Someone suggested using fork(), however I need a solution for both windows and posix. Even if I would use fork() ... would it be possi...
I can include this file directly now without tr1 in VS 2010 but can't find description of this file anywhere on MSDN. Where is a reference to regex header on MSDN?
...
I have a uint32 variable for some bit field flag state and an enum for these flags. This variable is passed as argument to some functions by value.
I need to add about 20 more flags to it. What are my best options? Extend it to 64 bits or treat it as an array of 2 32bits?
Extending to 64 bits will lead me to use compiler 'extensions',...
I'd like to do the following:
template <typename T>
struct foo
{
template <typename S>
friend struct foo<S>;
private:
// ...
};
but my compiler (VC8) chokes on it:
error C3857: 'foo<T>': multiple template parameter lists are not allowed
I'd like to have all possible instantiations of template struct foo friends of foo<...
I'm interfacing with a native 3rd party C++ DLL via C# and the provided interop layer looks like below:
C#:
[DllImport("csvcomm.dll")]
public static extern int CSVC_ValidateCertificate(byte[] certDER, int length);
C++:
CSVC_Status_t CSVCOMM_API CSVC_ValidateCertificate(BYTE* certDER, DWORD length,
DWORD context = CONTEXT_DEFAUL...
I recently read this post: http://stackoverflow.com/questions/2550281/floating-point-vs-integer-calculations-on-modern-hardware and was curious as to the performance of my own processor on this quasi-benchmark, so I put together two versions of the code, one in C# and one in C++ (Visual Studio 2010 Express) and compiled them both with op...
Is there any function in C++ which converts all data types (double, int, short, etc) to string?
...
Does anyone know any trick I could use to keep the Derived class until the base class destructor have been called?
i.e:
#include <iostream.h>
class Base
{
public:
Base(){ cout<<"Constructor: Base"<<endl;}
virtual ~Base(){ cout<<"Destructor : Base"<<endl;}
};
class Derived: public Base
{
//Doing a lot of ...
My code is:
void main() {
person student[10];
student[0].names[0] = 'C';
student[0].names[1] = 'a';
student[0].names[2] = 'm';
student[0].names[3] = 'i';
student[0].ages = 16;
student[0].sex[0] = 'F';
student[0].sex[1] = 'e';
student[0].sex[2] = 'm';
student[0].sex[3] = 'a';
student[0].sex[4] = 'l';
student[0].sex[5] = 'e';...
I have following class:
template <size_t size>
class Araye{
public:
Araye(int input[]){
for (int i=0;i<size;i++)
araye[i]=input[i];
}
int araye[size];
};
How should I write a cast-to-reference-to-array operator for this class so that following works:
int adad[3]={1,2,3};
Araye<3> araye(adad);
int (&reference)[3]=araye;
...
I have an enum in a namespace and I'd like to use it as if it were in a different namespace. Intuitively, I figured I could use 'using' or 'typedef' to accomplish this, but neither actually work. Code snippet to prove it, tested on GCC and Sun CC:
namespace foo
{
enum bar {
A
};
}
namespace buzz
{
// Which of these two methods I ...