Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - RetroX

586
Announcements / Re: Happy New Year
« on: January 28, 2010, 06:28:18 PM »
Exactly. You just did it with a non-class template parameter, which generates a new copy of all member functions for every size. Why not make it a property and pass it to the constructor?
AFAIK, I thought that the point of templates is so that you don't waste size copying all of the functions.  Meaning that it uses the template to make a function on runtime, or something, unless I'm wrong.

587
Announcements / Re: Happy New Year
« on: January 27, 2010, 08:35:46 PM »
Unfortunately, C/C++ arrays have no "length" property, unlike Java arrays. Hence the purpose of my code.
Of course, I could think of ways to optimize my Array/StaticArray classes.
That's because it would require storing it in another variable, using up space.

588
General ENIGMA / Re: Useful Tips
« on: January 27, 2010, 08:34:03 PM »
Click here to pronowns something in Ing-lish

589
Announcements / Re: Happy New Year
« on: January 26, 2010, 02:56:25 PM »
Well, you could have this

Code: [Select]
int sum(Array<int>* numbers){
   int result = 0;
   for(int i = 0; i < numbers->getLength();++i){
       result += numbers[i];
   }
   return result;
}

int main(){
    StaticArray<int, 10> array1;
    StaticArray<int, 20> array2;
    printf("%d\n", sum(&array1) + sum(&array2));
    return 0;
}
Also this:
Code: [Select]
template<class T,int size> int sum(array<T,size> numbers)
 {
 ...
 }

EDIT: Rusky, it's not really any more or less efficient.  If anything, a template uses less space.  And, it's usually a bit cleaner, sometimes.

590
Off-Topic / Re: What do you think of the IPB "Edit" button?
« on: January 26, 2010, 02:54:29 PM »
Leave it separately.

591
Announcements / Re: Happy New Year
« on: January 24, 2010, 09:24:52 PM »
I thought about that too, but I didn't remember the syntax for type templates in C++.

Code: [Select]
template <typename T>
class Array{
public:
virtual int getLength() = 0;
};

template <typename T, int size>
class StaticArray : public Array<T>
{
public:
T data[size];
virtual int getLength(){ return size; }
};

int main(){
StaticArray<int, 10> array;
return 0;
}
What exactly is the point of the first class?  It doesn't do anything, and you don't really need it.

592
Announcements / Re: Happy New Year
« on: January 20, 2010, 06:55:52 PM »
Code: [Select]
class Array{
public: virtual size_t getLength() = 0;
};

class StaticArray<int length> : public Array{
public:
void* arrayData[T];
virtual size_t getLength(){
 return length;
}
}

I didn't bother to check if this compiles, but if this is possible, then it's a more efficient solution for static arrays with a getLength property than the ones I used in the past.
Better example than mine.  Although, another thing that I would add is changing void to a class T in the template.

593
General ENIGMA / Re: Enigma on other platforms
« on: January 20, 2010, 06:53:56 PM »
If we're talking about homebrew, well, yeah, the Wii wins.  But, this is about official stuff.

Also, handheld != console.

594
Announcements / Re: Happy New Year
« on: January 20, 2010, 03:23:32 PM »
So basically manual RTTI and/or virtual functions?
RTTI, yes, virtual functions... I guess, but not really.

Bad example, but:
Code: [Select]
template<bool negative> class number
 {
 public: uint64 value;
 public: bool is_negative() { return negative; }
 }

595
General ENIGMA / Re: Enigma on other platforms
« on: January 20, 2010, 03:17:43 PM »
It's built to be a gaming platform so the experience on the 360 v. the PC will usually be better.
Depends on the opinion.  Personally, I like the PC gaming experience, better. :P

Quote
It's also better hardware-wise than the Wii and cheaper than the PS3, so the shared games aren't much of a problem either.
A valid point as well, however, the price of XBL makes the price almost not make a difference.

Quote
Basically, it doesn't suck.
In my opinion, all of the current consoles suck. :P
But, if you want to compare:
- Wii has some good games, crap hardware (relatively speaking), and tons of bad games
- PS3 has few games, but most of them are good, and you can use the console for other things than just games
- 360 is just a PC without the PC part and only games, and you have to pay for online; if you really want to use a console instead of a PC for games (and multiplayer on the same console), it is good, but besides that, it doesn't really have any unique aspects

596
Do we ever get miniature faggots?

597
General ENIGMA / Re: Enigma on other platforms
« on: January 19, 2010, 03:52:31 PM »
How is it a terrible console? It seems that you hate everything decent that Microsoft has made just because not everything they make is decent.
The 360 is a terrible console for the reason that almost every game for the 360 is on the PC, 1/5 of the 360s get RRODs, and the fact that most of the games tend to be flat-out boring first-person shooters (and the ones that aren't are on the PS3/Wii, too).

*sniff* I smell uninformed suck-up

He's just pointing out that RetroX has no reason for his position, and that he has long history of this.
And because you're probably going to misunderstand this post too, I'm just pointing out that you are just posting inflammatory crap just to create an image for yourself.
I honestly have no counter-argument, as most of it is true.  But a lot of that could be said about most everyone else, too, despite the fact that I do it more than everyone else.  Also, fyi, I'm not as bad as I was about six months to a year ago.

598
Announcements / Re: Happy New Year
« on: January 18, 2010, 07:40:35 PM »
...why do you need templates for that?
So that you can have a constant value in a certain class as a type.  That class alone is useless, but you can store other things in it.  That meaning, you can actually find out what class is what and perform an action based upon this depending on what the class is.

599
Announcements / Re: Happy New Year
« on: January 17, 2010, 10:39:57 AM »
What's with the const? Template parameters take the pickiest form of const you can even imagine. That's like prefixing "long" to a Bignum.
Code: [Select]
template<int id> class thing
{
public: int get_id() { return id; }
}

600
Announcements / Re: Happy New Year
« on: January 16, 2010, 12:04:47 PM »
In C++ you can make statically-allocated containers of varying sizes:
Code: [Select]
template <typename Value, int size>
class Stack {
private:
    Value value[size];
public:
    ...
};

or create constant values for classes:
Code: [Select]
template<const int id> class thing
{
public: const int get_id() { return id; }
}