Hi guys!
I need help with functions in objective C?
In C++ i can make a function like this:
int testFunction(int zahl) {
int loop;
loop = zahl * 10;
return loop;
}
this function multiply my zahl with 10 and returns the result. In C++, i can call this function whenever i want with:
testFunction(5);
and it returns 50. ...
I have an issue where I have an interface that has parts that make sense as templated, and parts that make sense as not-templated. I'm in the middle of a refactor where I'm splitting that out into two different interfaces where the more specific (the templated one) inherits from the other one. E.g., say I have an interface IArray, this...
I'm working with some windows API to create a little application.
I already created the buttons, windows, alright.
But the problem is the components I created don't look like the OS theme. They look very simple:
See the button as example.
How do I enable the Windows theme? It can be in C or Delphi.
...
Given
std::map<int,std::string> myMap;
fillMyMapWithStuff(myMap);
// modify key values - I need to add a constant value to each key
for (std::map<int,std::string>::iterator mi=myMap.begin(); mi != myMap.end(); ++mi)
{
// ...
}
Whats a good way apply some re-indexing? Must I remove the old entry and add a new one with the new key ...
#include <stdio.h>
struct B { int x,y; };
struct A : public B {
// This whines about "copy assignment operator not allowed in union"
//A& operator =(const A& a) { printf("A=A should do the exact same thing as A=B\n"); }
A& operator =(const B& b) { printf("A = B\n"); }
};
union U {
A a;
B b;
};
int main(int argc, c...
I have a function build with function pointers. I think it might be faster to try to exchange this function with pre processor macro. At least, I would like to try out the macro so I can measure if it generates faster code.
It's more or less like this:
typedef int (Item::*GetterPtr)(void)const;
typedef void (Item::*SetterPtr)(int);
vo...
When I compile on VS 2008 in deubg mode everything works fine.
When I compile the same thing in release mode not everything works. As far as I can tell the include directories are the same and there are no additional preprocessor symbols.
Any help?
1>zlib.cpp 1>C:\Program Files
(x86)\Microsoft Visual Studio
9.0\VC\include\xutil...
Possible Duplicate:
What good technology podcasts are out there?
Are there good CS programming and Eletronics podcasts? Itunes U has a many classes turned into podcasts, but most of them are terrible to follow without video.
...
Hi I want to (multiply,add,etc) vector by scalar value for example myv1 * 3 , I know I can do a function with a forloop , but is there a way of doing this using STL function ? something like the {Algorithm.h :: transform function } ??
...
How is this done in C++0x?
std::vector<double> myv1;
std::transform(myv1.begin(), myv1.end(), myv1.begin(),
std::bind1st(std::multiplies<double>(),3));
Original question and solution is here.
...
std::vector<string> names;
std::vector<string>::iterator start = names.begin();
std::vector<string>::iterator end = names.end();
sort (start,end);
//are my start and end valid at this point?
//or they do not point to front and tail resp?
...
I thought I could use #pragma once to solve my problems but it's not working.
Here is my issue.
I have Agui.h which I wanted to be my main header which everything includes:
this is it:
#pragma once
/*
This header includes all the required headers
required for Agui
Author: Josh
*/
//Standard library (STL)
#include <s...
If I use a container of shared_ptrs and explicitely allow access to its elements, should I return shared_ptrs or raw pointers if I intend the container to be the one responsible for "cleaning up"?
class Container
{
private:
std:vector<shared_ptr<Foo> > foo_ptrs;
public:
shared_ptr<Foo> operator[](std::size_t index) const {}; //...
I have a class called fraction, and I'm declaring some operators as friends. I declared the friend operators beforehand, as http://www.parashift.com/c++-faq-lite/templates.html#faq-35.16 told me to do, but it only fixed +, -, *, and /. << and >> still don't work.
template <class T> class Fraction;
template <class T> Fraction<T> operator...
I know its simple code, How do I fix "System not declared in scope" problem?
#include<iostream>
using namespace std;
int main(void)
{
system ( "TITLE Calculator" );
system ( "COLOR 2" );
char cChar;
double dfirstnumber;
double dsecondnumber;
char cDoagain;
do
{
system("CLS");
cout << "...
Im using Qt4 and c++ for making some programs in computer graphics. I need to be able to print some varaibles in my console in runtime, not debugging, but cout doesnt seem to work even if I add the libraries. Is there a way to do this? can some one help me?
...
Googling don't find anything. Are they created at point of use, or are the generic parts shared between instances?
(Same for template classes?)
...
I am to start writing my first Android application starting next week here at work. I am curious about the video and results of it found here: http://www.youtube.com/watch?v=It8xPqkKxis
The submitter indicates that c++/c# runs faster than Java on the Android platform though this was on Android 1.5.
At any rate, can anyone confirm that ...
Hi All
I just have a quick question, on how to speed up calculations of infinite series.
This is just one of the examples:
arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + ....
Lets say you have some library which allow you to work with big numbers, then first obvious solution would be to start adding/subtracting each element of the sequence u...
Could someone help me figure out what this C++ code does I got it somewhere but want to understand it. I have figured out some of it but some things I cannot get my head around. Here it is:
vector<double> prices; // vector of option prices
vector<int> strikes; // vector of strikes
char buffer[100]; ...