Check if C++ Array is Null
how do i do that? well i want to check if the array is empty ...
how do i do that? well i want to check if the array is empty ...
Does anyone know where to find a reference for boost error codes. In particular, error codes returned by asynchronous socket handlers?, Google and grepping the header files have tuned up empty. Thanks. ...
I have the following piece of code in C++: #include <iostream> #include <fstream> #include <string> using namespace std; int main(){ wstring ws1 = L"Infinity: \u2210"; wstring ws2 = L"Euro: €"; wchar_t w[] = L"Sterling Pound: £"; wfstream out("/tmp/unicode.txt"); out.write(ws1.c_str(), ws1.size()); out << ws1...
I had a C++ interview recently where I was asked, how does the compiler differentiate static data members having the same name in two different classes? Since all static data variables are stored in the data segment, there has to be a way by which the compiler keeps track of which static data belongs to which class especially when they...
This is basically the sample code from the 'Getting started' section of the documentation in which I stubbed out an ObjectTemplate provided with a NamedPropertyHandler. The JSON.stringify is just there to trigger an enumeration over the object's keys. The code can be compiled and run as is. #include <v8.h> using namespace v8; Handle...
I tried to write a short function to invert an std::map<K, V> (I know about boost.bimap, this is for self-education), and found, to my surprise, that the code that GCC 4.4 accepted with -pedantic -ansi settings was rejected as const-incorrect by SunCC (5.8, from 2005). Since value_type is std::pair<const K, V>, SunCC insisted that I con...
I have read Answers to C++ interview questions among which there is one that puzzles me: Q: When are temporary variables created by C++ compiler? A: Provided that function parameter is a "const reference", compiler generates temporary variable in following 2 ways. a) The actual argument is the correct type, but it isn't Lv...
Hello, I have an object of class which has private constructor: class CL_GUIComponent { // ... private: CL_SharedPtr<CL_GUIComponent_Impl> impl; CL_GUIComponent(CL_GUIComponent &other); CL_GUIComponent &operator =(const CL_GUIComponent &other); CL_GraphicContext dummy_gc; }; I have a class which has a pointer t...
I have spend like one out in this example, and everytime I get the error Unable to read cin with an ios_base::iostate equal to failbit from this code: #include "dates.h" #include <iostream> #include <ctime> #include <locale> #include <sstream> #include <iterator> using namespace std; void trasnlateDate(istream&in, ostream&out){ c...
My knowledge of C++ is small as I have only taken a couple classes. I undersand the basic case of using a friend function to overload the input, output stream operator for the "simple book example" of a Point object that has x, y instance variables. I am looking at a real project now, trying to understand what someone wrote and am gett...
I am working on a small web browser on c++ using IWebBrowser2, the problem is that when I delete cookies on my browser, they get deleted for IE, and I dont want to interfere with IE cookies. Is there a way to solve this? ...
Consider the following trivial program adopted from the boost program options examples #include <boost/program_options.hpp> #include <boost/version.hpp> #include <iostream> int main( int argc, char** argv ) { namespace po = boost::program_options; po::options_description desc("Options"); unsigned foo; desc.add_option...
I am building an application that consists of both a windows driver written in C and a user mode executable in c++. They both use a shared header file to define several macros, constants, enums, etc. In the c++ version, I want to include everything within a namespace, which a feature not supported by the c compiler. Is there certain v...
What does the C++ compiler do when coming ambiguous default parameters? For example, let's say there was a function such as: function1(int a = 0, float b = 3.1); function2(int a, float b =1.1, int c = 0); Is the above considered ambiguous? If not, what does the compiler do (how is the function matched exactly) when calling something l...
I decided after a bunch of headaches all morning, that using Qt Creator for my first Qt project would probably be better than MSVC (had too many issues compiling). I am wondering though how I can add the .dlls and .libs I need for my external tools through Qt Creator. I found this post http://stackoverflow.com/questions/718447/adding-ex...
should the following result in undefined behavior? should value of pointer2 be NULL? double *pointer = 0; double &value = *pointer; double *pointer2 = &value; ...
I want to do following, I am writing Graph library. I want my class should be template. template < typename T> class Graph { } This Graph class works on another class Vertex How should I design this Vertex class so that any of my team members can use and I do not have to change my implementation in class Graph Basically I want this ...
Any recommendations for libraries to implement calculation of the matrix exponential? ...
Where can one find a list of the function signatures for all operator overloads? ...
I am using SAX2 in Xerces C++ and would like to get XML Schema data while I handle elements so that I know their type defined in the Schema. How can I accomplish this? ...