I do not understand the termination parameter of this for loop. What does it mean? Specifically, what do the ?, ->, and : 0 represent?
for( i = 0; i < (sequence ? sequence->total : 0); i++ )
...
Please don't mind that there is no insert fnc and that data are hardcoded. The main purpouse of it is to correctly implement iterator for this container.
//file Set.h
#pragma once
template<class T>
class Set
{
template<class T>
friend ostream& operator<<(ostream& out, const Set<T>& obj);
private:
T** myData_;
std::size_...
Hi! I have been reading SO for some time now, but I truly cannot find any help for my problem.
I have a c++ assignment to create an IAS Simulator.
Here is some sample code...
0 1 a
1 2 b
2 c
3 1
10 begin
11 . load a, subtract b and offset by -1 for jump+
11 load M(0)
12 sub M(1)
13 sub M(3)
14 halt
Using c++, I ne...
I have a bunch of MACROS in c++ code that expand into some functions. And I am debugging something. Just want to see what the code ends up looking like”
Any ideas?
...
Lets us consider the following program :
#include <stdlib.h>
int main(int argc, char **argv){
int a,b;
if (argc != 3)
return -1;
a = atoi(argv[1]);
b = atoi(argv[2]);
a = b ? a/b : 0;
return a;
}
The task is to crash the program by providing arguments in command-line.
...
Inspired by the maturity problems I am facing porting on Mono Mac & Linux. I am investigating the use of Qt as an alternative. I am curious to hear about your favorite Qt experiences, tips or lesser known but useful features you know of.
Please, include only one experience per answer.
...
When does pruning stop being efficient in a depth-first search? I've been working on an efficient method to solve the N-Queens problem and I'm looking at pruning for the first time. I've implemented it for the first two rows, but when does it stop being efficient? How far should I prune to?
...
I'm making a Notepad clone. Right now my text loads fine but where their are newline characters, they do not make newlines in the text field.
I load it like this:
void LoadText(HWND ctrl,HWND parent)
{
int leng;
char buf[330000];
char FileBuffer[500];
memset(FileBuffer,0,500);
FileBuffer[0] = '*';
FileBuffer[...
I am trying to define a full specialization of std::basic_string< char, char_traits<char>, allocator<char> > which is typedef'd (in g++) by the <string> header.
The problem is, if I include <string> first, g++ sees the typedef as an instantiation of basic_string and gives me errors. If I do my specialization first then I have no issues...
Several console based applications like vim or lynx offer a rich user interface which enables the user to navigate freely around the console, manipulate data directly on screen, access menus and much more, similar to "modern" gui applications.
How is that being achieved in principal on Unix/Linux with C++? Do you directly manipulate some...
I am working on a Augmented reality Project where I plan to use ARToolkit for Image Capturing and rendering where as ARToolKitPlus for marker detection.
The problem is ARToolKit is a C library where as ARToolKit+ is written in C++. Can some one please sugegst me a way to integrate them both.
ARToolKit Library
ARToolkitPlus
...
I want to make a combo box with all of the computer's installed fonts enumerated in it. I'm not sure how this is done. Do I need to access the registry to get this?
Thanks
...
Hi!
The question plot (a bit abstract, but answering this question will help me in my real app):
So, I have some abstract superclass for objects that can be rendered on the screen. Let's call it IRenderable.
struct IRenderable {
// (...)
virtual void Render(RenderingInterface& ri) = 0;
virtual ~IRenderable() { }
};
And suppose...
Hello,
I am looking for a method to implement lock-free queue data structure that supports single producer, and multiple consumers. I have looked at the classic method by Maged Michael and Michael Scott (1996) but their version uses linked lists. I would like an implementation that makes use of bounded circular buffer. Something that us...
I want to implement basic spell checking in a Notepad clone project I'm doing. I want to underline misspelled words with a squiggly like like Word does. I think I need to use GDI and draw on the text field, but I'm not sure how to draw on controls.
Thanks
...
I want a portable C++ IDE for general development, and too to develop basic Windows GUI applications.
In my research, I've found this (with latest version date):
CodeLite IDE (2010-04-02)
Ultimate++ (2010-03-16)
Qt Creator (2010-02-01)
NetBeans (2009-12-10)
Code::Blocks (2008-02-28)
Bloodshed Dev-C++ (2005-02-22)
But I don't know if...
I haven't used C++ in a while, so I decided to take on a small project to become familiar with it again. I am trying to make a chinese checkers game, but I have no experience with GUI design in C++. Is there a real simple way to just make grid (i.e. bitmap hexagons or something) that when clicked on, will give me the index number of the ...
Consider the following list:
[LinkNode * head -- LinkNode * node1 -- LinkNode * node2]
I'm creating a stack of FIFO.
I Call pop() which I want to pop node1.
LinkNode::LinkNode(int numIn) {
this->numIn = numIn;
next = null;
}
.
.
.
int LinkNode::pop() {
Link * temp = head->next;
head = temp->next;
int popped =...
After I use setcontrolfont, the text of the text field does not update. The onnly way I fixed this is by removing then readding all text but this seems hackish. How can I do it properly?
Thanks
*its a function I made:
void SetControlFont(HWND hand, int size, char* name)
{
HGDIOBJ hfDefault;
hfDefault = (HGDIOBJ)CreateFontA(siz...
The following code does not compile:
#include <iostream>
class Foo {
std::string s;
public:
const std::string& GetString() const { return s; }
std::string* GetString() { return &s; }
};
int main(int argc, char** argv){
Foo foo;
const std::string& s = foo.GetString(); // error
return 0;
}
I get the following error:
const...