Ok, this is a bit of a cheeky question. I want to build a simple text editor (using my own text mode screen handling). I just want a good example of data structures that can be used to represent the text buffer, and some simple examples of char/text insertion/deletion. I can handle all the rest of the code myself (file i/o, console i/o e...
I need to find occurrences of ~ 25 000 words within a text. What is the most suitable algorithm/library for this purpose?
target language is C++
...
A little-used feature of C++ is the ability to create unnamed (anonymous) namespaces, like so:
namespace {
int cannotAccessOutsideThisFile() { ... }
} // namespace
You would think that such a feature would be useless -- since you can't specify the name of the namespace, it's impossible to access anything within it from outside. Bu...
Does anyone know of any good C++ code that does this
...
I have a dialog box that allows users to set hotkeys for use in a 3d program on windows. I'm using CHotKeyCtrl, which is pretty good, but doesn't handle some keys that the users would like to use - specifically, tab and space.
The hotkey handling is smart enough to be able to fire on those keys, I just need a UI to let them be set. A...
Due to the legacy nature of some of our code, we're still using Microsoft Visual 6.0 (SP6). When I attach to a running process to debug it for the first time, it has no knowledge of where the source files are located when I break into the process. It therefore asks me to navigate to the appropriate directory in my source tree, given a so...
I am supposed to provide my users a really simple way of capturing video clips out of my OpenGL application's main window. I am thinking of adding buttons and/or keyboard shortcuts for starting and stopping the capture; when starting, I could ask for a filename and other options, if any. It has to run in Windows (XP/Vista), but I also wo...
I have a set of callback classes that I use for handling callbacks with variable numbers of parameters. Right now I have about 6 different instances of it to handle differing numbers of arguments. Is there a way to make one instance than can handle a variable number of arguments?? Ultimately I would love to have each parameter be a POD t...
Given the following:
&row->count
Would &(row->count) be evaluated or (&row)->count be evaluated in C++?
EDIT: Here's a great link for C++ precedence.
...
I have written something that uses the following includes:
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <commctrl.h>
This code works fine on 2 machines with the Platform SDK installed, but doesn't run (neither debug nor release versions) on clean installs of windows (VMs of c...
I would like invoke a function call in a one shot manner. What's the best way to do this in Boost / C++?
I would like to pass it two parameters and do not need a result.
...
I have a double value f and would like a way to nudge it very slightly larger (or smaller) to get a new value that will be as close as possible to the original but still strictly greater than (or less than) the original.
It doesn't have to be close down to the last bit—it's more important that whatever change I make is guaranteed to pro...
I've always had an interest in creating my own games, and now at university I have the opportunity to create some 2D and 3D games using Java and C++ for those who are that way inclined.
I've never really programmed a game before, let alone graphics, so I'm completely new to the area. After a quick trip to the library today I came across...
Java has its own (self-documented) Javadoc, PHP has PHP.net, all the MS documenation can be found at the MS Developers Network, but whenever it comes to throwing together some C++ my first stop is always Google.
To all the C++ developers out there, what's your one-stop-shop?
...
I have an application that launches a webpage in the "current" browser when the user selects it. This part of my app works fine in the Windows version but I can't figure out how to do this in Linux build.
Right now the Linux version is hardcoded for Firefox in a specific directory and runs a new instance of it each time and doesn't show...
In an AI application I am writing in C++,
there is not much numerical computation
there are lot of structures for which run-time polymorphism is needed
very often, several polymorphic structures interact during computation
In such a situation, are there any optimization techniques? While I won't care to optimize the application ...
Is there a good reason why there is no Pair in Java? What would be the equivalent of this C++ construct? I would rather avoid reimplementing my own.
It seems that 1.6 is providing something similar (AbstractMap.SimpleEntry), but this looks quite convoluted.
...
Yet again, my teacher was unable to answer my question. I knew who may be able to...
So, I've never really learned C. In C++, I would, obviously, use a cout statement all of the time. In a recent assignment, my teacher told us to make sure to put
setbuf( stdout , NULL );
at the top of main() in order to get an unbuffered output, thu...
I'm storing an object (TTF_Font) in a shared_ptr that is provided to me from a third-party API. I cannot use new or delete on the object, so the shared_ptr is also provided a "freeing" functor.
// Functor
struct CloseFont
{
void operator()(TTF_Font* font) const
{
if(font != NULL) {
TTF_CloseFont(font);
...
See title: what does it mean for a C++ function to be inline?
...