.NET framework has got a Dictionary<TKey,TValue> class which is implemented as hash tables and provides data retrieval in constant time (O(1)). I am looking for a similar implementation in C++. I know about std::map but in this data retrieval takes logarithmic time. Is there any good hash table implementation in C++ which will retrieve d...
I have a very general question. I wish to determine the boundary points of a number of objects (comprising 30-50 closed polygons (z) each having around 300 points(x,y,z)). I am working with a fixed viewport which is rotated about x,y and z-axes (alpha, beta, gamma) wrt origin of coordinate system for polygons.
As I see it there are two ...
Hi,
I get a warning when compiling below code in VS2008 with MFC turned on. Boost version 1.39
include "boost/flyweight.hpp"
include "boost/flyweight/key_value.hpp"
class Foo
{
public:
Foo(const CString}
private:
const CString mfoo;
};
struct Conversion
{
const CString}
};
using namespace boost::flyweights;
flyweight<...
Dear All,
I have the following problem. I am trying to integrate a large code written by me with a QT interface. Some of my functions return std::string; I did not succeed in making setText accept them (other functions returning char do not give me problems).
What should I do? Thanks!
Giuseppe
...
I came across this example here:
#include <vector>
#include <cstddef>
template<typename Tag>
class Ref_t {
std::size_t value;
friend Tag& element(Ref_t r, std::vector<Tag>& v) {
return v[r.value];
}
friend const Tag& element(Ref_t r, const std::vector<Tag>& v)
{
return v[r.value];
}
public:
// C'tors, a...
My current workflow:
hg update (or whatever one uses to check out a revision)
MyProject.pro → qmake → MyProject.vcproj
Open Visual Studio, edit files
Build project
During the build step, how can I update my config.h header file with information from version control system (e.g. hg id)?
MyProject.vcproj is generated by qmake, so I sh...
I want a write a program that run an executable image without creating a new process... I want to do this because I want to use plink that send a password to a remote ssh server...
The plink program sends the password provided in command line .. If I use fork and exec functions someone can see the password provided in command line usin...
Hi,
Is the following valid?
class myClass
{
private:
...
int m_nDataLength;
boost::shared_array<int> m_pData;
...
public:
myClass(): ..., m_nDataLength(10), m_pData(new int[m_nDataLength]), ...
{
}
}
Am I right in assuming that the initialization will happen exactly in the order I've given in ...
We use gettext for translations in our product, but have had a lot of problems with it:
Can't use a language unless the system supports it.
On Solaris 9 Sparc, if we reset the environment to various English locales, the message still won't be translated, if the machine doesn't have the corresponding locale. The translation file is pr...
I'm working on a desktop email client right now, and I want to unit test my backend. However, I can't see a way to make that work. In order for my code to work, it has to connect to a working mail server. Unless I tie my unit tests to an email account, and make sure that account matches the state my tests expect, I don't see how I can ma...
I'm looking for a way to cheat and create some very rough translations of my Qt application using Qt linguist and an already-existing translation service such as google translate.
There's a public API for google translate, so I'm hoping someone has already tried this, but I can't seem to find it. Has anyone seen anything like this befor...
Is there a way to programatically take a screenshot (or somehow get access to an image) of the current screen display on a mac?
Preferably, in C++, not Objective-C.
...
Hi
What info map file contain generated during compilation of project and how i enable /map option in makefile.
Language : c++
compiler : vc6
...
I want to (programmatically) print documents of various types, by asking Windows to do it (using the default associated application). How can I do this (in .NET or C++/Win32 API)?
For example, if I have MS Office and Acrobat Reader installed on the machine, PDF files should be printed by Acrobat Reader, and DOC files should be printed b...
For some compilers, there is a packing specifier for structs, for example ::
RealView ARM compiler has "__packed"
Gnu C Compiler has "__attribute__ ((__packed__))"
Visual C++ has no equivalent, it only has the "#pragma pack(1)"
I need something that I can put into the struct definition.
Any info/hack/suggestion ? TIA...
...
I was reading the Qt coding conventions docs and came upon the following paragraph:
Anything that has a constructor or needs to run code to be initialized cannot be used as global object in library code, since it is undefined when that constructor/code will be run (on first usage, on library load, before main() or not at all). Even i...
Some may feel this question is subjective. But, I feel this is among the most important things to be told to a programmer.
Is this a good function name to check for null values.
1. checkNull()
2. notNull()
3. isNull()
What if I write
checkIfNull()
I do not know how many people share the same feeling as I do, I have spent more time...
Hi, Does anyone have any idea why the following code would output "no match"?
boost::regex r(".*\\.");
std::string s("app.test");
if (boost::regex_match(s, r))
std::cout << "match" << std::endl;
else
std::cout << "no match" << std::endl;
...
i have shared the header file containing class definition of a Context Free grammar for a parser. Could you comment on the design.
this code is for my lab assignment.
may be we could get some good programming tips out of this code. is the class heirarchy good or too complicated.
#ifndef CFG_H
#define CFG_H
#include <iostream>
#include ...
I have following function with only a variable parameter list (Without supporting/fixed argument). Is it possible to get values passed to this function? I am using ANSI format.
Foo( ... )
{
}
Adding some more points for clarity. In my special case, the number of arguments and their types are stored in a .xml file as configurations wh...