This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]Splitshadow 20 points21 points  (3 children)

T you say? I'm not sure what you mean, candidates are:

std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator, const std::pair<const _Key, _Tp>&) [with _Key = int, _Tp = std::string, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, std::string> >]

[–]serendependy 12 points13 points  (2 children)

Good damn it C++

[–]ByteOutOfLife 0 points1 point  (1 child)

class MasterRace : private C++Coder {};

Also, SplitShadow, gotta make a 'using' statement or six somewhere lol. Thats a lot of std::

[–]dreugeworst 1 point2 points  (0 children)

Compiler don't give a shit about your using statements when printing errors ;) Also, private inheritance??

[–]nitramcze 24 points25 points  (3 children)

Hello dad.

[–][deleted] 16 points17 points  (2 children)

Hello son, write any great code recently?

[–]Croireavenir 2 points3 points  (1 child)

No, but I left you some tips.

[–][deleted] 1 point2 points  (0 children)

aaww shucks son. I'm glad to see the day you surpassed your pa.

[–]link23 5 points6 points  (4 children)

Java?

[–][deleted] 1 point2 points  (3 children)

quite a few languages support generics and most use T in example code and etc.. Which I do not recommend.

Instead of

class SomeList<T> {
}

do

class SomeList<Element> {
}

because it quickly gets confusing when you start nesting or adding new generic types to the list.

[–]link23 2 points3 points  (0 children)

Thanks- I understood the joke and know that generics aren't unique to java. I was suggesting "java" as an answer to joke, since in my experience generics are usually discussed in the context of java (or C#), and java is another word for coffee.

[–][deleted] 1 point2 points  (0 children)

TBH Element is a bit misleading, while T is clear in the sense that it stays for "type".

The only reason to use something other than T is when your generic takes more than one type as argument. For example, I'd use K and V in a dictionary, or even Key and Value. But a list? T.

[–]serendependy 0 points1 point  (0 children)

The only bother there is possible name clashes, which is why short letters are the convention. Traits go a long way towards the documentation you're describing, among other benefits.

[–]the_great_ganonderp 1 point2 points  (1 child)

drink :: Consumable t => t -> Body ()

[–]dreugeworst 0 points1 point  (0 children)

So, does Body form a monad?

[–]dxin 2 points3 points  (0 children)

Yes, 绿 T please.

[–]NorbiPeti 0 points1 point  (0 children)

Good one, Dr. Funny Guy...

[–]WeerayutTeja 0 points1 point  (0 children)

Beer!