Hi,
I have a template class that I m trying to explicitly instantiate:
template<T>
struct tmat2x3
{
...
typedef tvec3<T> col_type;
..
};
the operator is declared as follows:
template <typename T>
typename tmat2x3<T>::row_type operator* (tmat2x4<T> const & m, typename tmat2x3<T>::col_type const & v);
I am explicitly instantiating t...
I'm new to OpenGL and C++. Say I start with a 2D square (on the very left) like shown in the picture below. I want to make it interactive with the glutKeyboardFunc() so when I press a number a new box will draw next to the corresponding edge.
Figure the best way to do this is to have a tree structure that hold all the boxes. But I'm n...
I just found a bug that, strangely, occurred only when optimization was turned on (g++ -O2). It was an Arithmetic exception in the following code, when interval was set to zero (from a command line argument):
for(int i = 0; i < n; ++i) {
if((i + 1) % interval == 0) { // exception here
DoSomething();
}
}
It's obvious that modul...
I'm trying to interface a c++ member function with a legacy C library taking a function pointer - I can't see why this keeps coming up with link errors, Can anyone see why ?
link errors
/tmp/ccl2HY1E.o: In function `VerifyWrapper::verifyGlue(int)': callback.cpp:(.text._ZN13VerifyWrapper10verifyGlueEi[VerifyWrapper::verifyGlue(int)]+0xe...
New to C++ and its giving me a hissy fit.
The actual code is on a different computer and I can't copy it, so I'll do the best I can with pseudo code.
My endgame is to have a vector [of pointers] that can be accessed by several different objects. The way I attempted to go about this is have the original class that contains the vector to...
I am having a bit of trouble with creating a Binary Search using a templated dynamic array class and iterators. In my class I have the following function that causes an infinite loop.
iterator binarySearch(const T& value)
{
T * indexOfFirst = begin();
T * indexOfLast = (end() - 1);
size_t tempSize = m_size;
while (ind...
Sorry for opening this topic again, but thinking about this topic itself has started giving me an Undefined Behavior. Want to move into the zone of well-defined behavior.
Given
int i = 0;
int v[10];
i = ++i; //Expr1
i = i++; //Expr2
++ ++i; //Expr3
i = v[i++]; //Expr4
I think of the above expressions (in that order) as
...
Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc)
Class test
{
public:
int a=10;
void operator ++(int)
{
a=a++;
cout<<a;
}
};
after calling the function in main a displays same value?
if i put only a++ in ++ function then its works or a=a++ is workin...
bool checkSockaddr(sockaddr_in a, sockaddr_in b)
check if they two have the same address information.
...
I need help to design the best data structure for a GRAPH. The following is my implementation.
Please give your thoughts on this design.
#ifndef _GRAPH_H_
#define _GRAPH_H_
#include <map>
#include <vector>
#include <iostream>
#include <list>
template <typename T>
class Vertex {
public:
Vertex(){};
Vertex(T inVertex): m_ver...
Possible Duplicate:
In C arrays why is this true? a[5] == 5[a]
Consider the following code able to compile under VC2008.
int i = 0;
int *j = 0;
int k = 0;
i[j]; // OK?!?!
i[k]; // Compile Error.
I was wondering, what is the meaning of i[j] in this content?
...
In Win32 programming a handful of POD structs is used. Those structs often need to be zeroed out before usage.
This can be done by calling memset()/ZeroMemory()
STRUCT theStruct;
ZeroMemory( &theStruct, sizeof( theStruct ) );
or by value initialization:
STRUCT theStruct = {};
Although the two variants above are not equivalent in g...
I am a C++ programmer and over the years have been subjected to hearing the notion that STL is not good for use in embedded enviornments and hence usually prohibited in usage for embedded enviornment based projects.I believe STL libraries like Boost are far more powerful and provide a much more faster & less error prone means of developm...
Hi,
I want to access a file which is already opened with exclusive access by some other process (not under my control). I know that the I/O manager will not grant my request, as some other process is holding the lock (with exclusive access).
Is there any way by which I can bypass the checks (such as file opened in exclusive mode) made ...
Here's the callstack :
0480b000()
vcam.ax!CSourceStream::DoBufferProcessingLoop() + 0xe1 bytes
vcam.ax!CSourceStream::ThreadProc() + 0x13e bytes
vcam.ax!CAMThread::InitialThreadProc() + 0x51 bytes
kernel32.dll!7c80b713()
The callstack is from this thread:
0 > 0x000015b8 Worker Thread CAMT...
I am looking for a good and stable threadpool library for C++ that's fairly well documented. I know about the Native Windows thread pool API and the newer Vista Thread Pool API, however my program requires some backward compatibility, so perhaps an outside library I can provide with the program is better.
I have looked into Boost's thr...
I want to monitor all text selections made in any application by the user. Is that possible? I would prefer a solution in .net, but vanilla C++ is OK.
If not, can I monitor all text copy operations (CTRL+C) from a .net application?
similar question: http://stackoverflow.com/questions/653003/in-c-is-there-a-way-to-consistently-be-able-...
Hi
I have a old school c program that now and then
need to tell a C++ Qt based application about some "events" that has occurred on my system.
But when I started to work with this problem I noticed that some ipc techniques is quite easy to use in the c program.
And then we have some Qt specific styles that works quite well in the "Qt...
What is an "opaque value" in C++?
...
I have overloaded [] operator in my class Interval to return minutes or seconds.
But I am not sure how to assign values to minutes or second using [] operator.
For example : I can use this statement
cout << a[1] << "min and " << a[0] << "sec" << endl;
but I want to overload [] operator, so that I can even assign values to minutes or ...