Hello,
I have faced a quite strange thing related to stdext hashmap. I have to work with a lot of objects and it is a priority to access the elements in a fast way.
My program read the object values from a file and if it's a new element, then insert this value in a hashmap, if it is an already processed object, then changes the stored ...
My personal style with C++ has always to put class declarations in an include file, and definitions in a .cpp file, very much like stipulated in Martin York's answer to C++ Header Files, Code Separation. Admittedly, part of the reason I like this style probably has to do with all the years I spent coding Modula-2 and Ada, both of which h...
I'm writing a PC application in C++ that needs to detect when a user connects an SD card to his/her computer. I know how to detect when the card reader is connected, but I do not know how to detect when individual cards are connected/removed.
Does Windows have an IO interface to detect arrival/removal of SD cards?
[Update] the WM_DEVIC...
Whenever I follow C++ related IRC channels, I see folk giving each other C++ papers' standard's links to come to a decision on ongoing discussions, since they all boil down to standard, naturally. However, those papers are rather boring and hard to read. How do you manage to read those bloated papers? and Is reading those papers inevitab...
I am writing a CLI application for Linux in Geany (a C++ IDE). I want to link a simple config file reader class so it can be used in my program. Just including it doesn't work, I get undefined reference errors. I know how to do this in Dev-C++ on Windows, but not Geany. Thanks for helping!
...
In C++, whenever a function creates many (hundreds or thousands of) values, I used to have the caller pass an array that my function then fills with the output values:
void computeValues(int input, std::vector<int>& output);
So, the function will fill the vector output with the values it computes. But this is not really good C++ style...
I'm fairly new to C++ sockets.
Is there a book for beginners for C++ socket programming?
for windows i really need help ive been through alot of tutorials dont get any of it and im using dev-C++
...
I get this error when I try to connect to a remote SQL server using this connection string.
Error:
ODBC error:
28000118452[Microsoft][ODBC SQL Server
Driver][SQL Server]Login failed for
user ''. The user is not associated
with a trusted SQL Server connection.
Connection string:
"DRIVER={SQL
Server};SERVER=testserver,...
Is it possible to impersonate a u/p on a remote computer?
Ideally I would like to call the ImpersonateLoggedOnUser with a token I would obtain from logging into a remote computer.
I know I can make a valid connection using wnet functions, but just don't know about impersonation.
...
I want to have a single Visual Studio project that builds a DLL file and an import library (.lib) file. (An import library is a statically-linked library that takes care of loading that DLL file in other projects that use it).
So I went to Visual Studio C++ 2008 Express Edition, created a New Project of type Class Library, and set the ...
This has some lengthy background before the actual question, however, it bears some explaining to hopefully weed out some red herrings.
Our application, developed in Microsoft Visual C++ (2005), uses a 3rd party library (whose source code we luckily happen to have) to export a compressed file used in another 3rd party application. The ...
I'm looking for a way to add or remove files to/from an existing ZIP archive, or any other archive format for that matter as long as there are cross platform APIs, without having to rewrite a new zip file with new files added to it, or sans items deleted from it.
With ZIP files, the catalog is placed at the end of the file so that, an...
struct Foo
{
void SayHello()
{
std::cout << "Hi, I am Foo";
}
};
I have the above given struct. I have seen a usage like this in one of our code base.
Foo foo;
{
foo.SayHello();
}
IMO, It does same like
Foo foo;
foo.SayHello();
Or is there any advantage/difference for the first method?
Any thoughts?
...
The CRTP is suggested in this question about dynamic polymorphism. However, this pattern is allegedly only useful for static polymorphism. The design I am looking at seems to be hampered speedwise by virtual function calls, as hinted at here. A speedup of even 2.5x would be fantastic.
The classes in question are simple and can be cod...
I'm writing a program in Microsoft Visual Studio with C++ that will retrieve information from a .txt file. In that file there are negative numbers, but when I try to write a while loop that states what to do if there is a negative number, I get several errors.
Can someone please help me with this? Here is my code and I do realize th...
I'm trying to design a class that needs to dynamically allocate some memory..
I had planned to allocate the memory it needs during construction, but how do I handle failed memory allocations? Should I throw an exception? I read somewhere that exceptions should only be used for "exceptional" cases, and running out of memory doesn't seem ...
I am writing a fairly large and complex data analysis program and I have reached the point where I think it is about time to build a GUI for the program. So my question is:
Which GUI toolkit should I use?
I am completely new to coding and building GUIs and would appreciate any guidance that can be offered. It doesn't have to be the sim...
Does C++ provide a guarantee for the lifetime of a temporary variable that is created within a function call but not used as a parameter? Here's an example class:
class StringBuffer
{
public:
StringBuffer(std::string & str) : m_str(str)
{
m_buffer.push_back(0);
}
~StringBuffer()
{
m_str = &m_buffer[0...
Hi,
Why compiling C++ in Mac always create *.dSYM directories?
Is there a way to disable that?
...
C++ is a great language (imho).
But starting off with C++ as a completely new language to learn, which formative path would you suggest?
Books, websites, anything that could speed up learning without trading in knowledge and understanding for memorization and confusion. A path indeed, which leads to C++ knowledge and understanding in ...