As of now, compilers requires the template definitions in the h file itself, if it is used in multiple translation units.So you need to move the template functions to the h file. That should get rid of the link error. You can declare/define the template functions in the cpp file, if you are going to use those functions only with in that translation unit.
Prasannaa
User Profile
Collapse
-
Hi,
You need the static keyword only at the declaration. No need to have static
keyword at the declartion or during the call.
Thanks,
PrasannaaLeave a comment:
-
Hi,
Another simple method. Since month names are not going to change, you can create a static array with month names and just index (after checking for bounds) the array with the number.
Now it becomes a simple array index.
PrasannaaLeave a comment:
-
Hi ,
Based on your comments, I think the problem is because.you are overwriting the memory of a variable using others. This will happen when an array is accessed out of its index, which may belong the next members memory.
char arra[10];
int i;
arra[12] = 'a'; is changing the variable i;, So you may want to check the setmethods().
Regards
Prasannaa.Leave a comment:
-
Hi,
You can change your func signature as
checkForWin(boa rd& gameBoard, player *opponent = 0);
this way, you can pass in the player if needed(for the second use of the function). You can also use the following signature
checkForWin(boa rd& gameBoard, player& opponent = player());
but its not normally used, b'cos it creates an object (which may/may...Leave a comment:
-
Hi,
On your project Properties menu, under Debugging ,
there will be a command arguments sections. You can enter the command
line line args here.
Regards
PrasannaaLeave a comment:
-
Hi,
There is no way to associate a particular ctor to a container.
if you take a look at std::map help, the third arg is a comparison function
which helps the container in sorting, it has nothing to with object creation.
One more thing, When you use the map's[] operator , a default object is created(if not already present) and assigned to the key that you used as index, the assignment that you do...Leave a comment:
-
Hi,
There is no such function called (in your code)
UpdateBalanceDi splay(void/no args);
You have declared UpdateBalanceDi splay(decimal) , which takes a decimal.
I think you forgot to pass the value while calling the function.
Regards
PrasannaaLeave a comment:
-
Hi
I am also new to python.
I tried your code, it works fine for me.
(I use Python 2.5).
Regards,
PrasannaaLeave a comment:
-
Hi,
You can use lower_bound or upper bound to find the closest or exact
element.Please note that in order to use these ,the
container has to be sorted.(In your case it is, so you don't have to).
Regards
Prasannaa.Leave a comment:
-
Hi,
you have to prefix std::vector<std ::vector<T> >::const_iterat or with
typename as
Code:typename std::vector<std::vector<T> >::const_iterator
What would be more elegant is to typedef the const_iterator as
Code:typedef typename std::vector<std::vector<T> >::const_iterator const_iterator;
Leave a comment:
-
Hi ,
Another way is to use string.find(), and reverse() functions in a while loop.
find the first space, reverse the sub str using reverse , now update the start
with ++found, find the next space and repeat the logic till there is no space.
Regards
Prasannaa.Leave a comment:
-
Hi ,
Since i am not aware of the precise context, I assume that you need all the other functions to use vatiables declared in main(). You can do so my moving the variables to a struct , declare the struct in main, and change those functions to take this struct as argument(pass by ref). I think should solve the problem.
Regards,
Prasannaa.Leave a comment:
-
Hi ,
try this link
http://msdn2.microsoft .com/en-us/library/system.windows. forms.keyeventa rgs.aspx
Regards
PrasannaaLeave a comment:
-
Hi ,
Instead of arrays, you can use vectors and pairs.
Something like the below
::Code removed per Posting Guidelines::
Regards
PrasannaaLeave a comment:
-
Hi ,
The reason , why you don't get error
when you declare "int a;" as "static int a;" is because you are not using it
anywhere in the code, if u use it then you will get the link error.
Regards
Prasannaa.Leave a comment:
-
Hi
There sould not be any problems.
The following code compiles fine.
Post the error msgs that you got.
Code:#include <vector> using namespace std; template<class T> class vector_plus : public vector<T> { public: vector_plus(); void erase_item(const T& item) { iterator itr= find(begin(), end(), item);
Leave a comment:
-
Hi,
try
typedef typename std::list<T>::i terator my_iterator;
PrasannaaLeave a comment:
-
Hi,
Since Stack is a template class it needs a Template Argument.
Second, list and std namespace has to included.
class List_Stack : public Stack<T>
Code:#include<list> //using namespace std; template <class T> class Stack { public: virtual void push(T c) = 0; virtual char pop() = 0; }; template <class T>
Leave a comment:
No activity results to display
Show More
Leave a comment: