olli
I thought about that but it takes function as third argument... And due to function call time may increase..
It's best to run Benchmarks. In this example, time did *not* increase. http://quick-bench.com/j_QMwY3SqjjGlZvAGE3_vApkYfY When enabling optimization the functor might be inlined, so no function call occurs https://godbolt.org/g/6uuMBE I think using count_if would be a good use. Since C++17 you can pass an execution policy and 'counting' might be processed in parallel
Jasmin
Does Any one participates in competitive Coding Contests? i.e. Codechef, Hackerrank, Hackerearth etc.
Mat
Output is 5693 How
first x = x + y, then x++
Mat
So x = 20 + 35, then 55++ => 56
Anshu
Got 56 How 93
Mat
So ++35 (36) and ++56 (57), then y = 36 + 57 => 93
Mat
It's kinda simple
Anshu
Ok Got It ThankU I am Begineer
Mat
No problem. Go catch a good book/course/whatever about C/C++ and study every day :)
Anshu
Ya i Have One
Anshu
Ansi c
Anshu
from brian w. kernighan
Mat
K&R? Nice :)
P
Spelling mistake bro
Talula
Output is 5693 How
Because you don't have a space in the middle
Anonymous
http://cppquiz.org/quiz/question/125
Anonymous
do you think this quiz even has the right answer?
Dima
Yes it has
Anonymous
@Neko_cpp @ollirz i said, that program shouldn't even compiled... the main() not returning an int value to the function caller...
Anonymous
the function caller a.k.a. the os
Dima
Still can be compiled
Dima
And called
Dima
But later meh
olli
@Neko_cpp @ollirz i said, that program shouldn't even compiled... the main() not returning an int value to the function caller...
If control flows off the end of the compound-statement of main, the effect is equivalent to a return with operand 0.§ 6.6.1.5 (n4659) No explicit return is like returning 0
Anonymous
reference link?
Ս
hi there
Ս
Who can help me with multithreding?
Ս
This is my code with segmentation fault
Ս
olli
reference link?
http://eel.is/c++draft/basic.start.main#5
Anonymous
You can even jump the int from the main() definition
what does it mean? you mean void main() ?
Dima
There are no multithreaded stuff
Anonymous
Anonymous
wasn't it already forbidden in modern C++?
Mat
wasn't it already forbidden in modern C++?
Yep, but it will compile. Just saying that you can avoid stuff in the main function
Mat
It just throws a warning
Mat
nope
Mmmm, sorry for it. I forgot the part where is up to the compiler to manage this kind of stuff
Mat
My bad
Anonymous
ok
Mat
gcc just throws a warning
Anonymous
np
olli
what the "control" means? is it the "statements"?
the control flow describes the order of the statements. If the control flow exits main without an explicit return then 0 will be returned
olli
yes.. I do - fixed..
Anonymous
I am trying to convert string to int
Anonymous
but getting error stoi was not declared in this scope
Anonymous
ok ill google stringstream
Anonymous
will*
Mat
ok ill google stringstream
ill as I'll is correct :)
Anonymous
string. h
Anonymous
If control flows off the end of the compound-statement of main, the effect is equivalent to a return with operand 0.§ 6.6.1.5 (n4659) No explicit return is like returning 0
ok, so i guess that this sentence means: if all the statements in main() executed flawlessly, and if there's no explicit "return 0;" in the code, it'll be read as an implicit "return 0;" by the compiler, right?
Deni
Use stringstream
Stoi its better
Anonymous
:)
Anonymous
@Occupato @ollirz ok, thx for the info
Anonymous
Stoi its better
but its giving error
olli
you're welcome
Anonymous
and also thx @Neko_cpp
olli
string. h
C++'s string header does not end with .h #include <string>
Anonymous
i cant get what intended is
Deni
And be sure that string is included
Deni
#include <string>
Anonymous
Anonymous
this is code
Mat
Don't. See the pinned message to give us a proper rapresentation of your code
Mat
You're NOT using it properly
Asdf
Stoi its better
Not, it not type safe