« first day (473 days earlier)      last day (4474 days later) » 

3:02 PM
@DeadMG in Belgium you can earn a degree without ever following a course, only through exams and tasks. Wouldn't that be more productive for you?
 
yes
 
@rubenvb wut?
 
@TonyTheLion "diploma-contract" vs "examen-contract" kind of stuff. You enlist in all courses, in the former case you follow all seminars etc, in the latter case, you just study the subject (ie course material) and take an exam
as far as I understand that. It's made for people earning a degree when they already have a full-time job
 
BTW anybody going to be at the FOSDEM beer event on Friday night in Brussels?
 
I am sure there will be quite a few people
 
3:12 PM
anyone from here? ;)
 
@awoodland ohhh where in Bxls?
 
@TonyTheLion deliriumcafe.be for the social bit on Friday night and then ULB Solbosch campus sat/sun for the talks
 
@awoodland I'd love to go, but I can only get as far as bxls train station. I don't drive
are you going?
 
@TonyTheLion yeah with a minibus full of students
 
user784668
3:22 PM
@rubenvb What?
 
@Fanael you know, like a language runtime, but in LLVM bitcode, perhaps linked to OS libs (without the C runtime, be it msvcrt or glibc)
 
Hi everyone!
 
user784668
@rubenvb Why would you want to write anything in LLVM assembly?
 
I've been out of action for a two days (ill at home). I noticed something on Monday:
inlining class template methods is not a good idea.
 
@awoodland so you're also going to the cafe on friday eve?
 
3:25 PM
yeah
 
right, that's the only place I could come
just how is the question...
 
Basically the compiler instantiated all of the methods, even the ones that were not called!
 
I would offer a lift, but I don't think that we have any free seats
 
user784668
@rubenvb Really, why?
 
3:28 PM
hmmm, seems within reasonable walking distance from central station
 
Xeo
@Tony: Here's another version that works arguably more generic. :)
 
@Fanael for educational purposes. That my answer to all questions of that sort :P
 
user784668
@rubenvb There are better ways to waste your time, you know.
 
@TonyTheLion drop me an email at ajw@aber.ac.uk and I'll send you my mobile number if you're likely to be there.
 
@Fanael Like getting wasted on microbrews.
 
3:33 PM
@EtiennedeMartel lol
 
Strange to get a badge for an answer I gave 8 months ago.
 
@Xeo damn dude, you algorithm geek :P
oh the @Cat is here :P
 
Xeo
@TonyTheLion Yeah, and I just thought of a way to implement that in terms of std::remove_if :>
 
user784668
@Xeo Generic? Make it work for raw pointers.
 
Who cares about raw pointers.
 
3:38 PM
@Xeo dafuq.
 
Xeo
@Fanael It does already. oO
 
@CatPlusPlus raw geeks :P
 
Xeo
The algo works for all bidirectional iterators for input, and any output iterator for output.
 
user784668
@Xeo Oh right.
 
user784668
So --BidIt(first) is legal even for built-in types?
 
Xeo
3:41 PM
It should be.
Ah, damn. predec requires an lvalue. -.-
For whatever reason. Seriously.
 
user784668
Are you looking for std::prev?
 
Xeo
I think that would work for a temporary
Yep, works.
 
user784668
Funny. VC++ thinks --BidIt(first) is okay for raw pointers, but only in a template.
 
is there a way to check if a container passed to a function is a specific named container?
 
user784668
GCC spits an error no matter what.
 
user784668
3:47 PM
main.cpp: In function 'BidIt unstable_move(BidIt, BidIt, OutIt, const T&) [with BidIt = int*, OutIt = int*, T = int]':
main.cpp:24:38:   instantiated from here
main.cpp:7:3: error: lvalue required as decrement operand
 
so if I have 3 container of type vector<T>, when I pass container B I need to have different loop constraints then with the other two, all the other bits in my func are the same
 
user784668
@TonyTheLion What do you mean by "container B"?
 
well, I mean that I have 3 vectors that all contain the same type of element, but I need to somehow differentiate between the three when I pass them to my function
 
user784668
Why do you want that?
 
because inside my function, my loop constraint changes when that one particular container is passed
 
user784668
3:49 PM
What do you mean by "loop constraint"?
 
Write a tagged_vector wrapper.
 
I mean this: for (int i = 0; i < (someNumber); i++) I mean the someNumber is different for this one container
 
Encode the distinctiveness in the type.
 
user784668
@TonyTheLion So pass two iterators rather than a container.
 
the type that container holds?
 
Xeo
3:52 PM
Here we go, implemented in terms of std::remove_if. :) ideone.com/tPNPK
 
@Fanael hmmm, not a bad idea
 
Xeo
And now nicely packaged up in an answer :)
 
4:13 PM
That's nice.
 
Switch statements are so ugly...
bleh
 
Fast, write a program of the integers that compose array declared from the command line, and write a function that takes out elements of array equal to some input value.
Need it like in 4 mins.
 
Xeo
#include <algorithm>
#include <vector>
#include <iostream>
#include <iterator>

int main(){
  std::vector<int> v(std::istream_iterator<int>(std::cin), std::istream_iterator<int>());
  int eq_val;
  std::cin >> eq_val;
  std::copy_if(v.begin(), v.end(), std::ostream_iterator<int>(std::cout), [&](int i){ return i == eq_val; });
}
Should work.
 
@Xeo is the C++ lounge's bitch
 
home time for me :D
see y'all
 
4:28 PM
:D Wauuu! That was less than 3 mins
Thank you @Xeo
 
Xeo
(I don't really know if that actually works)
 
It says that expression must have class type.
 
Xeo
Gimme a sec
 
Strange, isn't copy_if removed from STL?
OK :)
 
Xeo
copy_if is C++11
 
4:32 PM
:) OK, didn't know they put it in
 
Xeo
#include <algorithm>
#include <vector>
#include <iostream>
#include <iterator>
#include <string>
#include <sstream>

int main(){
  std::string line;
  std::cout << "Enter input: ";
  std::getline(std::cin, line);
  std::stringstream input(line);
  std::vector<int> v((std::istream_iterator<int>(input)), std::istream_iterator<int>());
  int eq_val;
  std::cout << "Enter value to print from input: ";
  std::cin >> eq_val;
  std::copy_if(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "), [&](int i){ return i == eq_val; });
There we go.
 
That's exactly what is needed. :)
@Xeo, thank you.
 
Xeo
Live on Ideone: ideone.com/3goxJ
So, why did you need that?
You sounded like your life depends on it. :>
 
it was for my mark. :D
I got A.
:D
 
Xeo
lol?
 
4:42 PM
I wish someone could draw a cartoon of an effiecent manor.
 
@Xeo you just got used
 
Xeo
I want money for doing other's "homework". :(
Still, it sounded like a fun challenge with the "needed in like 4 min"
 
@Xeo Don't you wish you didn't have to make that pointless input variable ;-)
 
Xeo
@KerrekSB I think it's possible if you manually send EndOfInput (ctrl-D on win)
 
@Xeo No no, I was referring to the never-used-again lvalue
 
Xeo
4:48 PM
Ah
Yeah
 
@Xeo C-z on win, C-d on UNIX
 
Xeo
@sehe Thanks, no wonder it wasn't working..
Hm, I think I need another std::cin.ignore() then..
Or not.. meh, doesn't work
@KerrekSB Theoretically, if C++11 made std::xstream_iterator accept an rvalue ref, it would work, since the temporary isn't destroyed until the vector is built
Hmm....
 
@Xeo You can use that std::stay() we concocted last time.
 
Xeo
Damn, std::xstreambuf_iterator directly takes an std::xstream :(
Oh wait, it got another overload
 
@HassanSyed: Do you know this little gadget?
 
Xeo
4:55 PM
int main(){
  std::string line;
  std::cout << "Enter input: ";
  std::getline(std::cin, line);
  std::vector<int> v((std::istreambuf_iterator<char>(std::stringstream(line).rdbuf())), std::istreambuf_iterator<char>());
  int eq_val;
  std::cout << "Enter value to print from input: ";
  std::cin >> eq_val;
  std::copy_if(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "), [&](int i){ return i == eq_val; });
}
Any idea why this doesn't work? It prints nothing, aka the vector is empty.
 
@KerrekSB not the gadget no, iIknow of public key cryptography though :D why do you ask ?
 
streambuf-iterators? No idea...
 
Xeo
I think it has to do with the temporary being destructed before the vector is populated, but that shouldn't be the case.. temporaries live until the end of the full expression
 
Well, it does work with the ordinary istream-iterator...
as long as you make the rvalue-to-lvalue conversion
 
Xeo
@KerrekSB We did? I wasn't there, then.
It works on Clang. yay (if I remove the lambda)
Sadly, the output is the ascii code of the input. xD
(Including spaces)
 
Tin
5:02 PM
hi guys! i'm currently using ubuntu 11.04 and my g++ compiler's version is: 4.5.2
does somebody knows how could i easily upgrade the compiler to the 4.6.2 version?
i tried to follow some (suggestions)[daniweb.com/hardware-and-software/linux-and-unix/…, but couldn't find the mentioned version, after having updated the system. I tried mainly: sudo apt-get clean, sudo apt-get update, sudo apt-get install build-essential
 
quick question - I'm in a net cafe so I'm stuck with Windoze - I need a ssh/terminal program to connect to my server at home - what do you guys use?
 
@Xeo It was some time ago where we wanted to write a single-line loop that reads lines and tokenizes them into a vector.
 
@kfmfe04 I think the only reasonable program would be Putty
 
@John - thx - will try downloading now
 
Xeo
Yep, PuTTY
 
5:06 PM
@John @Xeo thx guys - looks good
@Tin fwiw, if you upgrade to 11.10, the standard compiler will be 4.6.1 via sudo apt-get install build-essential
 
Tin
@kfmfe04, thanks, i recently found an alternative solution by adding a PPA to my repositories. here the link
 
@Tin yup - that should work fine, too, if the build is any good - just make sure you are pointed to the right version after install
 
Challenge n0.2 Write a program of the integers that compose array declared from the command line, and write a function that removes out elements of array equal to some input value. ( using only dynamic memory now )
5 mins at most, after that no submissions, and I will present the code.
 
Same thing, because vector is dynamic memory.
 
lol
Are you sure? :)
 
5:19 PM
@DzekTrek Do you think people here would lie to you to throw you off?
 
Als
SOS
 
@Als Soup or salad? Neither, go straight for the meat.
 
Did you try to write "LOL" on an upside down keyboard?
 
@KerrekSB What is the uttermost, is the inevitable, therefore presumption exists.
 
Als
I am in midst in installing the VM and for some reason the First Start Wizard didn't show up
How do i set the OS without that?
 
5:20 PM
First start wizard of what?
 
Als
I only see a No Bootable medium found! system Halted
@CatPlusPlus: Oracle virtual box, setting up a VM
 
Also, I'm sad, because someone stole 15 rep from me. :(
 
where is your usb?
You have to have iso either on usb, cd or local disk
in order to start installation in VB
 
@Als make sure the binary you downloaded (Lubuntu) is an .iso
 
Als
@DzekTrek: I have an ISO, but as stated here ---> virtualbox.org/manual/ch01.html#idp7657248
the First start Wizard never popped up
I believe this is where the ISO setting is made after the wizard pops up
 
5:23 PM
Man, I have a feeling all of you troll here. My sense is going nuts. :(
@Als, enter VB
when you do that
 
Als
@kfmfe04: It is..
 
click on Make or whatever it is called in English
Sozdat is in Russian.
 
Als
@DzekTrek: huh, I see nothing of that sort
 
Find your iso
wait, did you enter Oracle VM VirtualBox?
 
Als
@DzekTrek: Yes
!
 
5:24 PM
Press CTRL+N
Did you?
 
Als
Yes doesnt work
 
wait
click next
type name of your OS
and choose what kind of os you are going to make
 
@DzekTrek I... don't think that was a sentence...
 
install*
 
Als
@DzekTrek: Thats all done. I am at this step : virtualbox.org/manual/ch01.html#idp7657248
and it doesnt show me any wizard
 
5:26 PM
Oh for Gods sake restart your PC
 
Als
geez i feel like useless or something
@DzekTrek: huh? need to restart?
 
yea, do so ...
 
Als
ok will be back in a mo..
 
is there a button/magic thing in NetBeans to comment many lines at once like VS has?
 
Yes
all or just particular ones?
 
5:30 PM
@DzekTrek the ones I have highlighted
 
second from the right
 
replace ^(.*)$ with // \1 in selected lines...
 
is the magic button for it
 
@DzekTrek what the? Why are there buttons under the tabs?
@DzekTrek Thanks!
 
I have no idea, maybe it's easier for us to see it that way.
np
 
5:34 PM
@DzekTrek now that I look at them, the ones above the tabs are all project-wide changes, those below the tabs are file/selection-wide
 
Yep :)
 
makes sense
 
;)
 
Als
Back
And it still doesnt show any darn wizard...
 
so you installed your OS?
did you build it?
just double click on the image
of one of the OS you have installed in your VM
 
Als
5:44 PM
Yes I installed a VM
and now i double click it in virtual manager
and it opens a dialog about event capture which is ok
and then it just shows a message no bootable medium found! system halted
 
lol man
you installed VM but not OS
in it
 
Als
ya well
 
but you have to install OS in it
 
Als
tht is what You have to do on first boot and that is where a first wizard pops up to let u select
 
from any bootable medium
that's exactly what I have been telling you
 
Als
5:46 PM
Ya i selectted an ISO image
 
just enter VM and type CTRL+n
 
Als
of lubuntu
 
so, it's ok now?
 
Als
no it didnt do anything
 
OK, but you need to specify the location of your "install cd"
did you make virtual memory for your VM
 
Als
5:47 PM
Yes I did
 
did you set virtual cd's for your VM
cd rom
 
Als
Devices->cd/dvd devices-> set virtual dvd
i did and nothing happened
 
load in that cd rom any iso you like
Go settings
in storage
add your iso
by clicking Add CD /DVD device
and add os.vdi to your SATA tooo
 
Als
Yes i ddi
*did
 
ok
now go to system
and make boot order like this
floppy, cd , hd
enable absolute pointing device too
 
Als
5:51 PM
it is already the same
 
click ok
 
Als
actually its all greyed out
immutable lol
 
what is gray?
go to new nnow
 
Als
the options in system were not modifyable
 
make it to be
go to new now
and make your OS
 
Als
5:53 PM
where is new?
 
but if you didn't make and .vdi you should better do it now
left of settings
 
Als
no new there
General, system, display,storage,audio,network,serial ports,usb, shared folders
I have only those options in settings
 
not in settings, but in main window
there is new, settings, start and so on like buttons
 
Als
u mean in the virtual manager?
 
yea
 
Als
5:57 PM
okay new then
 
follow procedure
 
Als
I already did that,
u mean create another VM?
start afresh? is that what u mean?
 
but you didn't assign iso to that VM?
yea,
double click or start
For assigning iso to that VM
just go to storage in settings
and under attributes
 
Als
I already have that setting in place
 
make CD/DVD device contain your iso location
 
Als
6:00 PM
under storage
 
so what is wrong?
 
Als
and cd/dvd points to the iso
 
ok
 
Als
do i need to restart the VM after this setting so on next statr up it picks up the ISO
 
yes
do it so
 
Als
6:01 PM
ok let me try
okay cool it shows the lubuntu menu now
 
:)
just try it
 
Als
so I should select Install Lubuntu now then
 
;)
yes
it's a standard procedure for installing OS now
 
Als
@DzekTrek: Yes! :) Thanks a bunch!
 
np :)
glad I helped
 
Als
6:05 PM
@DzekTrek: Thanks mate, you were a great help :)
 
cheers!
 
Als
:)
 
7
A: What's wrong with my vector<T>::erase here?

FredOverflowerase expects a range of iterators passed to it that lie within the current vector. You cannot pass iterators obtained from a different vector to erase. Here is a possible, but inefficient, C++11 solution supported by lambdas: active.erase(std::remove_if(active.begin(), active.end(), [](const T...

I never realized until now how much boiler-plate code is removed in functional C++ thanks to lambdas.
@DzekTrek It was an oversight not to include copy_if in C++98.
 
So strange :) Such a good function not to be included. But then again, remove_copy_if exists, so it's kinda the same, if you know how to use it.
 
@TonyTheLion Ideally, you would want to implement operator== as a non-friend, non-member function.
Only make friends in the name of efficiency.
@DzekTrek It was an error, they simply forgot to include it.
 
Als
6:16 PM
@FredOverflow: How would you compare for == if you don't have access to private members.
which most likely would be the case.
 
@TonyTheLion - I did a Boost.Python solution that "how can I implement a C++ interface in Python and use it in C++ still" question - stackoverflow.com/a/9100991/168175
 
I see.
I forgot to post a solution to challenge no2.
here it is
 
@Als If the interface to a type is so restricted that a client couldn't even tell if two objects were equal without calling operator==, there almost certainly is something wrong with the design.
 
@Als depends on the rest of the API. You wouldn't need it for vector for instance.
@FredOverflow Though Fred raises a good point
hmm, sometimes when I edit a previous post, the "cancel edit" button doesn't show. I just noticed that I can still click where it would appear to cancel though. Is that a known bug?
 
Als
@FredOverflow: Perhaps, but that depends on the need, an api would exist only if needed. Not all classes need the client to know if its object are equal.
 
6:22 PM
@Als in that case, why would you compare ==?
 
Challenge no3. is Write an array of 10 elements of the length of 10 characters. After that from the cmd line input the name of the file in which the array will be stored. Make a function in which first parameter will be array, and the second the name of the file in which you store that array. 5 mins at the most, after that I am posting the solution. ( dynamic array only )
P.S. this may be easy, but I don't want to give anything hard since it won't be funny if no one participate. Like this, all are invited plus we have some fun and inception who is the best of the best. :)
 
Als
@MooingDuck: You are making it an egg or chicken problem.
 
@DzekTrek Eew, arrays.
What's with all the SO questions confusing vector capacity and size, lately?
 
I am preparing also a graphic ones plus one with generic classes :) It would be fun! :)
 
Apparently someone is doing a bad job at teaching vectors.
@DzekTrek Beware though, "generic graphics" doesn't sound terribly appealing, especially to artists.
 
6:26 PM
We are all programmers here, so I don't think artists would be a problem. :)
 
@Als Fred said you should be able to tell if objects are equal without operator==, you said the api would only exist if needed. If it's needed, it should be there, if not, then you also don't need operator==. It is a chicken and egg problem. (Isn't it?)
@DzekTrek are you having a programming competition in SO chat? That problem is kinda easy isn't it?
@DzekTrek also that problem seems ill-defined. what should be in the array? Also: why dynamic array only?
 
Als
@MooingDuck: No probably you didn't need to compare the objects before and as an enhancement you might want to and you might argue that it is a bad design but then there are no ideal 100% full proof designs. You might say if you need to implement == you should provide comparison functions for the class perhaps private functions and then use them in the ==, that would make sense, but for that you would still need a friend.
 
@Als In general, I think Fred is right that a user should be able to check equality without ==, and == should also exist.
 
@MooingDuck Yes, I am trying to give make some fun in this chat. It's easy because I want all to participate. If you want next Q. will be tough one. OK, you can use whatever kind of array you like, but I noticed many of us here are not very well experienced with dynamic arrays.
 
Als
@MooingDuck: I didn't say Fred is wrong or you are wrong I said it depends
 
6:33 PM
@DzekTrek Why arrays when we have std::vector?
 
@DzekTrek you're the only person here with less than 3k rep on SO :D
 
Als
Oh btw I just got a c shiny yellow today :D
 
:D I have only 50 points.
41 to be exact
 
Well, 41 is less than 3000, isn't it? :)
 
:D
a lot less, but I will manage to achieve that number some time. ;) @Als Yes! :)
 
Als
6:35 PM
uhm, looks like you just scrapped through and got access to the chat
well 3000 is less than 45k though ;)
I just noticed right this moment among-st the peeps in this room I have the most rep
 
:) Man you are jack for us all here. :)
actually sbi has higher rep
 
but you are second in the chain which is fantastic
 
@DzekTrek he's not active atm though
 
Als
naah @FredOverflow has been here a lot earlier than I have
@DzekTrek: Oh you mean the old ape @sbi, yeah he like a ancient greek god garnering rep everytime he posts
and then there is the all time SO favorite Mr. Litb
:P
 
@Als yeah, I was wondering why you pinged him
 
:D
 
Als
@MooingDuck: Because It's been long since I said hello to @sbi
 
HELLO @SBI
 
@MooingDuck , OK, you first wrote it :) Nice.
 
Als
6:41 PM
;) well he's a ape alright but I still have immense respect for him
 
Speaking of that, hi everyone.
 
sbi
@MooingDuck Hello, strange cow.
 
Hi @RMartinhoFernandes .
 
Als
@RMartinhoFernandes: Oh the bot
 
sbi
@RMartinhoFernandes Why would "respect" be a cue for you to bang into the conversation?!
 
6:42 PM
hmm: ideone.com/yCEWH int main() {} result: success time: 0s memory: 2824 kB returned value: 0
 
@sbi People were speaking of saying "hello" just seconds before. Your attention span is lacking.
 
sbi
OMG! I'm on TVTropes! http://tvtropes.org/pmwiki/pmwiki.php/Main/TheTaleOfWestalaAndVilltin
 
Als
@DzekTrek: BTW i got this vm up, OS installed and its up and running nicely
 
sbi
That is one heck of an achievement!
 
Als
@RMartinhoFernandes: Age catches up and you dare not remind him of his age!
 
6:44 PM
@Als nice to hear it. :)
 
Als
@DzekTrek: Thanks once again :)
 
@sbi what is that?
 
@ALs, np :) glad I helped.
 
sbi
@MooingDuck That is a tweet of Örjan Westing. He's been collaboratively writing a tale for ages, and just found out there's an entry about it at TVTropes.
 
Als
@RMartinhoFernandes: Did ya notice my new shiny yellow? :P
 
6:46 PM
@sbi no, the book! A fanfic of a usenet group?
 
sbi
@MooingDuck Well, afp isn't just some Usenet group. It's a cosmos, really.
 
@sbi ...
 
sbi
@MooingDuck ???
 
@sbi TVTropes is known for its "No need to be notable" policy.
 
Als
Fire at will guys
1
Q: Some fun with condition in if statement

Mr.32i see one question like #include<stdio.h> void foo () { printf("hello"); return; } int main() { if(1) // chnange the condition foo(); else foo(); return 0; } Now here change the only if(1) condition such that foo() called twice and hello prints two times ... One solution...

That Q is begging for closure
 
sbi
6:48 PM
@RMartinhoFernandes So? Where's the entry about some achievement of yours at TVTropes?
 
Why is it always about me?
 
Als
@RMartinhoFernandes: Because All of us Love you the bot.
 
sbi
@RMartinhoFernandes Because you were leaning out your window so far.
 
posted on February 01, 2012 by Herb Sutter

GoingNative 2012 is a global live C++11-fest with unlimited free worldwide attendance – both live and on demand. The goal is to make it interactive, and we’ve asked the speakers to reserve time at the ends of their talks for questions. Tweet questions to #ch9live or #GoingNative and we’ll try and get them asked. To [...]

 

« first day (473 days earlier)      last day (4474 days later) »