hkaiser changed the topic of #ste||ar to: STE||AR: Systems Technology, Emergent Parallelism, and Algorithm Research | stellar-group.org | HPX: A cure for performance impaired parallel applications | github.com/STEllAR-GROUP/hpx | This channel is logged: irclog.cct.lsu.edu
K-ballo has quit [Quit: K-ballo]
hkaiser has quit [Quit: Bye!]
K-ballo has joined #ste||ar
hkaiser has joined #ste||ar
K-ballo has quit [Quit: K-ballo]
K-ballo has joined #ste||ar
hkaiser has quit [Quit: Bye!]
diehlpk has joined #ste||ar
diehlpk has quit [Client Quit]
diehlpk_work has joined #ste||ar
hkaiser has joined #ste||ar
hkaiser_ has joined #ste||ar
hkaiser has quit [Ping timeout: 252 seconds]
hkaiser_ has quit [Quit: Bye!]
hkaiser has joined #ste||ar
<gonidelis[m]> why does a vector (only?) moves its elements when the move constructor is `noexcept` ?
<gonidelis[m]> K-ballo:
<gonidelis[m]> ^^
<K-ballo> that's not a move construcotr
<K-ballo> vector's move constructor is always noexcept
<gonidelis[m]> why?
<K-ballo> why? the standard says so... what are you asking?
<hkaiser> gonidelis[m]: because it never throws
<gonidelis[m]> and how does the compiler optimizes based on the "it never throws" knowledge?
<gonidelis[m]> if it never throws then what? what optimization can be applied if it never throws?
<hkaiser> if a function never throws it doesn't need special code that can handle exceptions
<hkaiser> that simplified the generated code
<gonidelis[m]> if I, the user, won't put that special code, then is it not optimizes already? does the compiler have to know?
<hkaiser> simplifies*
<gonidelis[m]> ah... generated code
<K-ballo> the compiler often does already know, when the definition is in line
<K-ballo> generic code on the other hand would never be able to guess
<gonidelis[m]> ahhh
<gonidelis[m]> so it's templates that make `noexcept` necessary
<K-ballo> yes, and vector in particular
<K-ballo> inserting a single element on a vector offers the strong exception safety guarantee, because it was effectively free before moving semantics
<K-ballo> those were operations that required copying all the elements into a new buffer, so if something failed the source was unchanged
<gonidelis[m]> strong exception?
<K-ballo> don't know your exception safety guarantees?
<gonidelis[m]> wow
<gonidelis[m]> what do you mean "before moving semantics"?
<gonidelis[m]> before moving semantcis was a think you mean?
<K-ballo> moving semantics were introduced into C++ in C++11
<K-ballo> so before C++11
<gonidelis[m]> wow
<gonidelis[m]> how does `emplace_back()` offer that guarrantee
<gonidelis[m]> what does it do in order to guarantee that no exception will happen
<K-ballo> depends on the type (and language version)
<K-ballo> in general, either there's space in the current allocation or a reallocation is needed
<K-ballo> if there's space in the current allocation then the only thing vector has to do is construct the element and bump the size, if construction throws nothing was constructed, size isn't bumped, everything remains unchanged
<K-ballo> "if constructions throws, then nothing..."
<K-ballo> if reallocation is needed, then a new allocation is acquired, and all elements are copied over from the source (or moved if noexcept).. if allocation or a copy fails, the new allocation is dropped and everything remains unchanged
<K-ballo> once the new allocation is in place, the remaining steps are those for when there's space in the current allocation
diehlpk_work has quit [Ping timeout: 240 seconds]
diehlpk_work has joined #ste||ar