This is my code:
#include <algorithm>
void f() {
int[] a = {1, 2, 3, 4};
int[] b = {1, 2, 100, 101};
// I want to do something like this:
// int* found = compare(a[0], a[3], b[0]);
// in order to get a pointer to a[2]
}
Maybe I missed this algorithm in the manual… Please help :)
...
I need to know how to start writing an application based on plug-in architecture. I mean how to write a base code and let others develop the application by adding the plug-ins they write.
I know that there is some problems in doing so in c++. most people use another language such as python to add plug-ins to their c++ application.
...
How would you guys recommend I actually learn to program real things?
I mean, I know how to do basic academic things. I can implement a templated stack/queue/map/etc. data structure in C++ or Java or whatever. I can make a text-based hangman game or whatever. Etc etc.
But how can I learn to program something real, something useful? I'v...
My task is as follows :
Using pointers to class fields, create menu allowing selection of ice, that Person can buy in Ice shop. Buyer will be charged with waffel and ice costs.
Selection of ice and charging buyers account must be shown in program.
Here's my Person class :
#include <iostream>
using namespace std;
class Iceshop {
...
I have a template I want to specialize with two int types, one of them plain old int and another one is intptr_t. On 64 bit platform they have different sizes and I can do that with ease but on 32 bit both types are the same and compiler throws an error about redefinition. What can I do to fix it except for disabling one of definitions o...
This is my code:
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
class A {
struct CompareMe {
bool operator() (const string*& s1, const string*& s2) const { return true; }
};
void f() {
CompareMe comp;
vector<string*> v;
min_element(v.begin(), v.end(), comp);
}
};
And this is the e...
When i am inheriting from std::exception in order to define my own exception type, i need to override the what() method, which has the following signature:
virtual const char* what() const throw();
This definitely looks strange to me, like if there were two method names in the signature. Is this some very specific syntax, like with pu...
They are very different kind of languages and the way they handle exceptions might be rather different.. How is exception handling implemented and what are the implementation difference within these languages?
I am asking this question also because I noticed that C++ exception handling seems to be very slow compared to the JavaScript ve...
Is there an established or unofficial way of finding out if my application is running on a Windows Mobile 6.5.3 device or if it's a previous version? Managed or native doesn't matter and I don't mind interop-ing.
...
I'm using both Ogre and NxOgre, which both have a Real typedef that is either float or double depending on a compiler flag. This has resulted in most of our compiler warnings now being:
warning C4305: 'argument' : truncation from 'double' to 'Ogre::Real'
When initialising variables with 0.1 for example. Normally I would use 0.1f but t...
Is there a c++ library like Extjs that can be used in desktop applications written in c++?.
...
Hello,
Python -> c++ dll -> c# dll
I have a com interop c# dll that is loaded in a wrapper c++ dll throught the .tlb file generated in c# to be used in a python project. When I run in my computer it works fine but when I run in a computer that just got formated it gives:
WindowsError: exception code 0xe0434f4d
I have the redistribut...
I can already correctly detect the number of logical processors correctly on all three of these platforms.
To be able to detect the number of physical processors/cores correctly I'll have to detect if hyperthreading is supported AND active (or enabled if you prefer) and if so divide the number of logical processors by 2 to determine the...
I saw this code but I couldn't understand what it does:
inline S* O::operator->() const
{
return ses; //ses is a private member of Type S*
}
so what happens now if I used ->?
...
Possible Duplicates:
Good place to start learning ASP.NET
Help getting started in programming?
I am new to programming.How can I best start to learn?Thanx in advance......
...
After executing some new code, my C++ application started to behave strange (incorrect or incomplete screen updates, sometimes no screen updates at all).
After a while we found out that the new code is causing an Access Violation. Strange enough, the application simply keeps on running (but with the incorrect screen updates).
At first ...
Is it possible to use a non-type constant template parameter in a preprocessor directive? Here's what I have in mind:
template <int DING>
struct Foo
{
enum { DOO = DING };
};
template <typename T>
struct Blah
{
void DoIt()
{
#if (T::DOO & 0x010)
// some code here
#endif
}
};
When I try this ...
I had a post similar to this awhile ago based on a error I was getting. I was able to fix it but since then I been having trouble doing things because headers keep blocking other headers from using code. Honestly, these headers are confusing me and if anyone has any resources that will address these types of issues, that will be helpful....
Hi,
I a writing a Simulation program and wondering if the use of const double is of any use when storing intermediate results. Consider this snippet:
double DoSomeCalculation(const AcModel &model) {
(...)
const double V = model.GetVelocity();
const double m = model.GetMass();
const double cos_gamma = cos(model.GetFlightPath...