Timeline for Condense these page numbers!
Current License: CC BY-SA 3.0
18 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Dec 18, 2015 at 23:21 | comment | added | pinkfloydx33 |
why not claim the two extra from int b; (no =1) and inverting the rest? compiles with warning, sure... but it works
|
|
Dec 18, 2015 at 23:03 | history | edited | TheCoffeeCup | CC BY-SA 3.0 |
added 34 characters in body
|
Dec 18, 2015 at 22:59 | comment | added | pinkfloydx33 |
you can save 13 bytes using int b; swapping the if statements if(b) => if(!b) (and vise-versa), replacing the b=true with b=0 and the b=false with b=1
|
|
Dec 18, 2015 at 15:56 | history | edited | TheCoffeeCup | CC BY-SA 3.0 |
added 6 characters in body
|
Dec 16, 2015 at 0:59 | comment | added | user46167 | @TheCoffeeCup just tried compiling in vs, it works | |
Dec 16, 2015 at 0:54 | comment | added | TheCoffeeCup | @ev3commander yes, but it's a warning, and it seems to run fine with the warning. The question didn't state that it had to be warning-free. | |
Dec 16, 2015 at 0:50 | comment | added | user46167 |
Wouldn't this give unsigned-signed mismatch ? If it does, use C++11 or above and auto instead of int
|
|
Dec 15, 2015 at 4:53 | comment | added | cat |
@Mego Oh, duh. I don't know C++ but I saw the using and the includes and assumed a instantly compilable answer.
|
|
Dec 15, 2015 at 4:52 | comment | added | user45941 |
@cat That would be because this is a function, not a full program. Add something like int main(){cout<<f({1,2,3,4,5})<<endl;return 0;} to the code and it'll be a full program. With that addition, it compiles and runs fine under gcc 5.2.0 on Linux.
|
|
Dec 15, 2015 at 4:42 | comment | added | cat |
@Mego All -std=c++11 does is give me multiple screenfuls of errors and gcc saying Segmentation fault (core dumped) . This is gcc 4.8.4 on Linux. (Not that it matters that it won't compile for me)
|
|
Dec 15, 2015 at 4:39 | comment | added | user45941 |
@cat Make sure it's updated enough that it supports the C++11 standard. 4.3-ish should be good with -std=c++11 ; >= 5.0 has it on by default (actually it's -std=gnu11 , but close enough).
|
|
Dec 15, 2015 at 3:47 | comment | added | cat |
I don't think you need iostream either, but gcc gave: a.cpp: In function ‘std::string f(std::vector<int>)’: a.cpp:8:83: error: ‘to_string’ was not declared in this scope
|
|
Dec 15, 2015 at 3:02 | comment | added | sudo rm -rf slash | +1 always like to see C++. I can't test this, but I don't think you need iostream | |
Dec 14, 2015 at 0:23 | history | edited | TheCoffeeCup | CC BY-SA 3.0 |
added 34 characters in body
|
Dec 14, 2015 at 0:21 | comment | added | TheCoffeeCup | @kirbyfan64sos Thanks, didn't notice that. | |
Dec 13, 2015 at 23:05 | comment | added | kirbyfan64sos |
Why not use int instead of unsigned int ? Saves 9 bytes.
|
|
Dec 13, 2015 at 18:13 | history | answered | TheCoffeeCup | CC BY-SA 3.0 |