Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
tef
May 30, 2004

-> some l-system crap ->

Nomnom Cookie posted:

isn't timsort in c++ stdlib? it is in java. ofc if you took out the reinvented wheels 90% of c++ code would cease to exist

timsort is used for sorting objects in java, but they use a two pivot quicksort for sorting primitives, iirc. (hooray it's unstable but it doesn't matter)

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->
i still keep reading my posts and for a moment go 'oh look tbc has replied'

Nomnom Cookie
Aug 30, 2009



there's only one kind of equality for java primitives, so...yeah. i hope you weren't being sarcastic. you'd have to box the primitives to be able to distinguish stable from unstable

tef
May 30, 2004

-> some l-system crap ->

Nomnom Cookie posted:

there's only one kind of equality for java primitives, so...yeah. i hope you weren't being sarcastic. you'd have to box the primitives to be able to distinguish stable from unstable

yep, it is just java iirc uses a stable sort (timsort), but will use an unstable one when it doesn't matter. I think this is rather neat.

also i think that two pivot quicksort is quite neat.

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

thats because experienced c++ programmers have a personal library of hacked up containers they c+p into every project

no that's c programmers

Shaggar
Apr 26, 2006

tef posted:

timsort is used for sorting objects in java, but they use a two pivot quicksort for sorting primitives, iirc. (hooray it's unstable but it doesn't matter)

excuse me but some 2s are warmer than others and I need my sort to preserve that order

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

excuse me but some 2s are warmer than others and I need my sort to preserve that order

should go and use a p-lang then instead of java

X-BUM-RAIDER-X
May 7, 2008
java is a disease of the brain

Nomnom Cookie
Aug 30, 2009



tef posted:

yep, it is just java iirc uses a stable sort (timsort), but will use an unstable one when it doesn't matter. I think this is rather neat.

also i think that two pivot quicksort is quite neat.

Collections.sort uses mergsort because it has to work on Collection so u can def find some bad sorting in java stdlib. but it does good sorting if you use arrays, the best data structure

jony neuemonic
Nov 13, 2009



:getin:

Nomnom Cookie
Aug 30, 2009



Zlodo posted:

no that's c programmers

a c++ programer is a c programmer who thought "i'll just use a class in this one place where it makes sense"

Nomnom Cookie
Aug 30, 2009



two years later they're unironically writing move constructors and there's nothing to be done at that point but find them a job reinventing something. current makework project for the c++ team at work is serialization

tef
May 30, 2004

-> some l-system crap ->

Nomnom Cookie posted:

Collections.sort uses mergsort because it has to work on Collection so u can def find some bad sorting in java stdlib. but it does good sorting if you use arrays, the best data structure

timsort is a mergesort :3:

Shaggar
Apr 26, 2006

Nomnom Cookie posted:

Collections.sort uses mergsort because it has to work on Collection so u can def find some bad sorting in java stdlib. but it does good sorting if you use arrays, the best data structure

Collections.sort in 7 uses timsort, idk what it uses in 6 (normal mergesort or modified). It also works only on Lists, not Collections since Collections are not necessarily ordered

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

Collections.sort in 7 uses timsort, idk what it uses in 6 (normal mergesort or modified). It also works only on Lists, not Collections since Collections are not necessarily ordered

must be 6 i'm remembering then. and what if i want to sort a set? this method signature is not suiting my needs

Shaggar
Apr 26, 2006
use a treeset or other sorted set

Nomnom Cookie
Aug 30, 2009



i dont want a treeset i want a hashset, trees are slow. sorted hashset

Shaggar
Apr 26, 2006
treesets are slow because their sorted.

Bloody
Mar 3, 2013

Nomnom Cookie posted:

a c++ programer is a c programmer who thought "i'll just use a class in this one place where it makes sense"

oh no... oh god no...

im becoming a c++ programmer

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

two years later they're unironically writing move constructors and there's nothing to be done at that point but find them a job reinventing something. current makework project for the c++ team at work is serialization

i dunno whats peoples beef with move constructors and rvalue references

in a nutshell: only temporaries will bind to a rvalue reference function parameter, and a rvalue reference that have a name is considered a normal reference. you can use the std::move helper to turn something into a rvalue reference as an explicit way to hand it over to some other function, knowing that the object will be in an undefined but valid state after the call

that's all you need to know for 90% of uses

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

treesets are slow because their sorted.

right thats why i want a sorted hashset

Nomnom Cookie
Aug 30, 2009



Zlodo posted:

i dunno whats peoples beef with move constructors and rvalue references

in a nutshell: only temporaries will bind to a rvalue reference function parameter, and a rvalue reference that have a name is considered a normal reference. you can use the std::move helper to turn something into a rvalue reference as an explicit way to hand it over to some other function, knowing that the object will be in an undefined but valid state after the call

that's all you need to know for 90% of uses

ty for providing an example of a c++ programmer

X-BUM-RAIDER-X
May 7, 2008
c++ really sucks. a lot. at least, that's what you think until you eventually realise that every other programming language is poo poo as well, perhaps even shitter.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Nomnom Cookie posted:

i dont want a treeset i want a hashset, trees are slow. sorted hashset

LinkedHashSet

http://docs.oracle.com/javase/7/docs/api/java/util/LinkedHashSet.html

onl;y maintains insertion order, so you need to insert in-order

Shaggar
Apr 26, 2006

Nomnom Cookie posted:

right thats why i want a sorted hashset

you cant have one

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

OBAMA BIN LinkedIn posted:

c++ really sucks. a lot. at least, that's what you think until you eventually realise that every other programming language is poo poo as well, perhaps even shitter.

I am currently being forced to use c++ for a thing at work. at first I was bleh but then I was "c++11 is actually not a bad language"

is it stockholm syndrome or is it wisdom

shrughes
Oct 11, 2008

(call/cc call/cc)
it's wisdom. C++11 solves the main C++ problems.

and omg i'm in san jose airport right now and i've seen more dell latitudes today than i have in the rest of my life

X-BUM-RAIDER-X
May 7, 2008

SavageMessiah posted:

I am currently being forced to use c++ for a thing at work. at first I was bleh but then I was "c++11 is actually not a bad language"

is it stockholm syndrome or is it wisdom

it's wisdom but then you will hate it after a few months and wish you were using some p-lang or something. then you start using a p-lang for 3 months and hate that as well because of its subtle ambiguities that are all over the loving place and wish you were using C++ again.

Zlodo
Nov 25, 2006

OBAMA BIN LinkedIn posted:

it's wisdom but then you will hate it after a few months and wish you were using some p-lang or something. then you start using a p-lang for 3 months and hate that as well because of its subtle ambiguities that are all over the loving place and wish you were using C++ again.

once I tried to use a plang to prototype a thing quickly thinking "its the reasonable thing to do" and I kept mixing everything up and ending up with some null pointer in the rear end end of my data because at some point before I mistakenly put the wrong thing somewhere

them I just scraped that thing and started doing it in c++ and it went much better

plang are useful only for small trivial things, for anything a bit complex you really need static typing to be any productive

c++ is the best language in the "provide as many abstraction tools in the language without compromising performance" niche and when you have 30ms to update and render a bunch of poo poo it means its by far the best language

X-BUM-RAIDER-X
May 7, 2008

Zlodo posted:

once I tried to use a plang to prototype a thing quickly thinking "its the reasonable thing to do" and I kept mixing everything up and ending up with some null pointer in the rear end end of my data because at some point before I mistakenly put the wrong thing somewhere

them I just scraped that thing and started doing it in c++ and it went much better

plang are useful only for small trivial things, for anything a bit complex you really need static typing to be any productive

c++ is the best language in the "provide as many abstraction tools in the language without compromising performance" niche and when you have 30ms to update and render a bunch of poo poo it means its by far the best language

then you learn how to create p-lang bindings to C++ objects :ssh:

PrBacterio
Jul 19, 2000

SavageMessiah posted:

I am currently being forced to use c++ for a thing at work. at first I was bleh but then I was "c++11 is actually not a bad language"

is it stockholm syndrome or is it wisdom
it's stockholm syndrome

I mean c++ was already bad before, but c++11 ... god. it's almost as if they did it on purpose, to serve as an example of what feature creep and the desperate need to plug holes left over by previous design choices will do to a language, and how heaping an ever growing list of additional features will only ever serve to make things worse.

Zlodo
Nov 25, 2006

OBAMA BIN LinkedIn posted:

then you learn how to create p-lang bindings to C++ objects :ssh:
yeah of course there's that too but thats only useful of you want to give designers a lot of flexibility in scripting the game (which you don't necessarily do depending on the type of game you're making)

if only coders are going to touch the code its easier for everything to be in c++. easier to debug and easier not to waste too many unnecessary cycles on the slow cpus they put in consoles

Zlodo
Nov 25, 2006

PrBacterio posted:

it's stockholm syndrome

I mean c++ was already bad before, but c++11 ... god. it's almost as if they did it on purpose, to serve as an example of what feature creep and the desperate need to plug holes left over by previous design choices will do to a language, and how heaping an ever growing list of additional features will only ever serve to make things worse.

please be even less specific, your posts arent lovely enough yet

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Zlodo posted:

please be even less specific, your posts arent lovely enough yet

concepts are cool where did they go

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Zlodo posted:

no it isn't

std::sort is how you sort in c++

if it isn't how c++ people sort how come a c++ person showed it off as a great way to sort like four pages ago

Bloody
Mar 3, 2013

Cocoa Crispies posted:

if it isn't how c++ people sort how come a c++ person showed it off as a great way to sort like four pages ago

autism

MononcQc
May 29, 2007

Zlodo posted:

once I tried to use a plang to prototype a thing quickly thinking "its the reasonable thing to do" and I kept mixing everything up and ending up with some null pointer in the rear end end of my data because at some point before I mistakenly put the wrong thing somewhere

what plang did you use?

X-BUM-RAIDER-X
May 7, 2008

PrBacterio posted:

it's stockholm syndrome

I mean c++ was already bad before, but c++11 ... god. it's almost as if they did it on purpose, to serve as an example of what feature creep and the desperate need to plug holes left over by previous design choices will do to a language, and how heaping an ever growing list of additional features will only ever serve to make things worse.

yeah i agree it sucks that the language designers would actually add additional useful features into the language to make the programmer's life easier. i almost slit my wrists when i heard raii was a central theme of c++11. it was a nightmare.

X-BUM-RAIDER-X
May 7, 2008

Cocoa Crispies posted:

if it isn't how c++ people sort how come a c++ person showed it off as a great way to sort like four pages ago

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

you cant have one

thats why im learning c++ so the man can't keep me from having lock-free sorted hashsets


Malcolm XML posted:

concepts are cool where did they go

you can sorta fake it with templates so the committee didn't want to add them because of "bloat". instead c++ programmers get enable_if :laugh:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply