Click here to Skip to main content
15,891,864 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: WHats Kortrijk in Belgium like? Pin
JimmyRopes9-Feb-14 7:09
professionalJimmyRopes9-Feb-14 7:09 
GeneralRe: WHats Kortrijk in Belgium like? Pin
Erudite_Eric9-Feb-14 7:54
Erudite_Eric9-Feb-14 7:54 
GeneralRe: WHats Kortrijk in Belgium like? Pin
V.9-Feb-14 10:06
professionalV.9-Feb-14 10:06 
GeneralRe: WHats Kortrijk in Belgium like? Pin
Erudite_Eric11-Feb-14 0:16
Erudite_Eric11-Feb-14 0:16 
GeneralRe: WHats Kortrijk in Belgium like? Pin
V.11-Feb-14 2:08
professionalV.11-Feb-14 2:08 
GeneralRe: WHats Kortrijk in Belgium like? Pin
dan!sh 9-Feb-14 18:55
professional dan!sh 9-Feb-14 18:55 
GeneralRe: WHats Kortrijk in Belgium like? Pin
Erudite_Eric9-Feb-14 21:01
Erudite_Eric9-Feb-14 21:01 
GeneralI hate it when I am too clever for my own good... Pin
OriginalGriff9-Feb-14 4:59
mveOriginalGriff9-Feb-14 4:59 
So, I'm doing some analysis code, and I need a couple of moving averages - one over the whole sample, one over the last 30 samples, and one over the last ten samples.

Now, I don't fancy doing that in SQL, so I'm doing it in C#, and I decide the obvious thing to do is create a MovingAverage class that you Add samples to, and it sorts itself out. Easy peasy.

So I knock up the class framework, and the code that will use it, and then go back to fill in the class. And decide to make it generic because hey, I might want to use it again. Change everything to use generics - easy - and off we go...except...you can't sum generics, because they are based on object which doesn't implement arithmetic operators. And you can't restrict generics to classes that support arithmetic either...

So either I restrict it to just primitive types (int, double, blah blah blah) or I drop the whole idea...and you can't use primitive types as generic constraints...and it wouldn't work if you could, because primitive arithmetic is implemented via static inline functions at compile time, so you couldn't use 'em in a generic if you wanted to!

So...change it back Griff, change it all back... D'Oh! | :doh:
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

GeneralRe: I hate it when I am too clever for my own good... Pin
PIEBALDconsult9-Feb-14 5:05
mvePIEBALDconsult9-Feb-14 5:05 
GeneralRe: I hate it when I am too clever for my own good... Pin
OriginalGriff9-Feb-14 5:17
mveOriginalGriff9-Feb-14 5:17 
GeneralRe: I hate it when I am too clever for my own good... Pin
PIEBALDconsult9-Feb-14 5:57
mvePIEBALDconsult9-Feb-14 5:57 
GeneralRe: I hate it when I am too clever for my own good... Pin
OriginalGriff9-Feb-14 6:36
mveOriginalGriff9-Feb-14 6:36 
GeneralRe: I hate it when I am too clever for my own good... Pin
harold aptroot9-Feb-14 5:33
harold aptroot9-Feb-14 5:33 
GeneralRe: I hate it when I am too clever for my own good... Pin
OriginalGriff9-Feb-14 5:44
mveOriginalGriff9-Feb-14 5:44 
GeneralRe: I hate it when I am too clever for my own good... Pin
Kornfeld Eliyahu Peter9-Feb-14 6:38
professionalKornfeld Eliyahu Peter9-Feb-14 6:38 
GeneralRe: I hate it when I am too clever for my own good... Pin
PIEBALDconsult9-Feb-14 6:44
mvePIEBALDconsult9-Feb-14 6:44 
GeneralRe: I hate it when I am too clever for my own good... Pin
Kornfeld Eliyahu Peter9-Feb-14 7:02
professionalKornfeld Eliyahu Peter9-Feb-14 7:02 
GeneralRe: I hate it when I am too clever for my own good... Pin
PIEBALDconsult9-Feb-14 7:07
mvePIEBALDconsult9-Feb-14 7:07 
GeneralRe: I hate it when I am too clever for my own good... Pin
Kornfeld Eliyahu Peter9-Feb-14 7:18
professionalKornfeld Eliyahu Peter9-Feb-14 7:18 
GeneralRe: I hate it when I am too clever for my own good... Pin
Jörgen Andersson9-Feb-14 9:07
professionalJörgen Andersson9-Feb-14 9:07 
GeneralRe: I hate it when I am too clever for my own good... Pin
Kornfeld Eliyahu Peter9-Feb-14 9:22
professionalKornfeld Eliyahu Peter9-Feb-14 9:22 
GeneralRe: I hate it when I am too clever for my own good... Pin
Jörgen Andersson9-Feb-14 9:49
professionalJörgen Andersson9-Feb-14 9:49 
GeneralRe: I hate it when I am too clever for my own good... Pin
Kornfeld Eliyahu Peter9-Feb-14 9:53
professionalKornfeld Eliyahu Peter9-Feb-14 9:53 
GeneralRe: I hate it when I am too clever for my own good... Pin
Jörgen Andersson9-Feb-14 10:10
professionalJörgen Andersson9-Feb-14 10:10 
GeneralRe: I hate it when I am too clever for my own good... Pin
Brisingr Aerowing9-Feb-14 6:52
professionalBrisingr Aerowing9-Feb-14 6:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.