Lounge<C++>

Today we're daydreaming about C++26 reflection
Sep 5, 2012 11:52
@Xeo, liveworkspace.org/code/a2624cc520d912ff1b935c9a92019e8f does tell you what the error is, but you also get a wall of errors
Sep 5, 2012 11:48
don't have an example handy, but probably if you assign vector<int> to vector<double> or messed up iterator dereferencing or something
Sep 5, 2012 11:48
because everytime it happens, I have to try to work out where the incompatible type assignment is instead of the compiler pointing me directly to the line
Sep 5, 2012 11:47
is there a way to make it give you reasonable error messages like if you used primitive types?
Sep 5, 2012 11:46
I see @Xeo, it's a bit like when you have vector<int> and try to assign incompatible types. For some reason, the STL loves giving you errors inside the STL instead of at the location of your own code.
Sep 5, 2012 11:42
ie. something that cin >> hasn't been defined for @Xeo?
Sep 5, 2012 11:42
or something?
Sep 5, 2012 11:42
do you mean a custom object type like class custom {}
Sep 5, 2012 11:41
ok, took me a while to read your code @Xeo, what do you mean with "To further ensure that the user gets no wall-of-overloads presented when T is not input-streamable"
Sep 5, 2012 11:32
didn't think through it well enough - you are allowed to copy const values to a non-const var
Sep 5, 2012 11:31
because you are copying it
Sep 5, 2012 11:31
oh yeah, of course
Sep 5, 2012 11:31
@DeadMG, doesn't it work if I return a const type?
Sep 5, 2012 11:28
ok, fine, but what if you tried to check sizeof(a).
Sep 5, 2012 11:28
almost as if you said f(int *a) instead
Sep 5, 2012 11:27
maybe a[] allows any length arrays?
Sep 5, 2012 11:26
@Bartek, I think "auto X = in_get<int>();" is probably less typing than if "const int X = in_get();" were possible
Sep 5, 2012 11:21
@Xeo, so auto works, but I had to comment out the cin>>, is there a way to give it standard input?
Sep 5, 2012 11:14
ideone doesn't, so I can't test it myself
Sep 5, 2012 11:14
well, I changed the return type of my function to const explicitly, so you can use auto (if your compiler supports it)
Sep 5, 2012 10:35
link to the question and I'll post my answer
Sep 5, 2012 10:35
good job @Bartek, problem solved
Sep 5, 2012 10:33
and int cin_int() {int a; cin >> a; return a;}
Sep 5, 2012 10:33
like, const int constantinteger = cin_int();
Sep 5, 2012 10:32
how about calling a function to cin
Sep 5, 2012 10:29
depends on whether the const_cast returns an L-value
Sep 5, 2012 10:29
don't know without trying it
Sep 5, 2012 10:28
maybe you can cast it?
Sep 5, 2012 10:28
unless it's a string, and you do cin.getline() or something
Sep 5, 2012 10:28
the problem is you can't initialize with the cin statement
Sep 5, 2012 10:27
don't think there's any other way
Sep 5, 2012 10:27
or more if the rule for edges are complex
Sep 5, 2012 10:26
@BartekBanachewicz One line? when you write it out for an actual problem its more like 6 lines
Sep 5, 2012 10:26
const-protect? not sure what that is.
Sep 5, 2012 10:25
I just meant, reimplementing the whole while (!pq.empty()), pop, and for each edge push thing
Sep 5, 2012 10:25
of course I know that
Sep 5, 2012 10:25
because every problem is different
Sep 5, 2012 10:24
because I find myself re-implementing it all the time
Sep 5, 2012 10:24
@Bartek is it a completely general Dijkstra container?
Sep 5, 2012 10:23
@Bartek, do you know because it is available on the net or something?
Sep 5, 2012 10:20
Geek insists on knowing the answer
Sep 5, 2012 10:20
0
Q: How to choose the space of optimal substructures for dynamic programming algorithms?

GeekI am reading up dynamic programming chapter of Introduction to Algorithms by Cormen et al. I am trying to understand how to characterize the space of subproblems . They gave two examples of dynamic programming . Both these two problems have an input of size n Rod cutting problem (Cut the rod o...

Sep 5, 2012 10:20
who knows an ultimate way of solving all dynamic programming problems?
Sep 4, 2012 10:34
yes! I have just reached my rep-cap. Work done for today
Sep 4, 2012 10:11
you should ask that question now!
Sep 4, 2012 09:57
if a game reduces the number of "dumb" clicks you must make, it allows you to make more "strategic" clicks
Sep 4, 2012 09:50
leaving you to focus on the strategy
 

Ruby on Rails

Arena for Ruby on Rails Developers to Collaborate & Ideate !!
Sep 5, 2012 09:09
@MID, by the way, what is your opinion on a good license, LGPL or MIT?
Sep 5, 2012 09:05
last time I was here, it was deserted
Sep 5, 2012 09:05
hmm, there's actually people in this room