« first day (913 days earlier)      last day (4027 days later) » 

5:00 PM
Well, I like it.
 
user142019
It depends on what you want to do.
 
I mean, it's pretty good for a lot of purposes
Maybe not something like game development or graphics... but...
 
C is terrible for every purpose
wait, you were talking about Python?
 
yeah python... it's generally what I go for first for general purpose. C++ for bigger projects
 
Is there a situation (maybe only theoretical) where C can beat C++?
 
5:04 PM
@Cheiron number of errors
 
@Cheiron number of suicides
 
Epic.
 
I can lick my own tongue
 
@Cheiron Exe size?
 
5:07 PM
@user703016 A program in C which is as type-safe as C++ and optimized with the same algorithms will yield the same size.
 
Xeo
@DeadMG Wazzat?
 
@user703016 15K rep, still dind't change username. That is an accomplishment.
 
@Xeo Proposed fix. If the trait is not true, SFINAE out heterogenous lookup
 
Xeo
constexpr forgotten? :P
 
no
in general, the functor may be stateful
 
Xeo
@DeadMG Where do you get your bool from at compile-time then?
 
@Cheiron When a C++ compiler is not available.
 
Xeo
Or do you simply mean that heterogenous will be left undefined?
@Cheiron No
 
@Xeo just no?
 
@Xeo Oh, uh, oops.
 
Xeo
5:12 PM
@Cheiron I could name myself "user123456" right now.
 
in the case that it's false, instead of SFINAEing out, the implementation shall simply perform an implicit conversion (no implicit conversion = ill-forned) to key_type and proceed as if you had called the regular function.
 
@Xeo Point taken.
 
@DeadMG I don't think so
 
Xeo
@DeadMG Mhm. You'd still likely want constexpr for the heterogenous. :P
 
can't
 
5:13 PM
how long does it generally take for employers to respond to submitting a resume if they're interested?
 
stateful functors make requiring that impossible
 
what the new subtitle about now? :\
 
user142019
@Crowz infinity.
 
Xeo
Eh, but all that thing does is returning true or false, no?
Maybe I need an example of what you mean
 
@Crowz Within a week or two (generally) but can increase depending on the amount of candidates they have
 
5:14 PM
yes
but it might need to know the state of the functor to know whether to return true or false.
 
Xeo
mhm
 
and you can't guarantee that state to be known as constexpr
 
@user703016 the place I applied to is hiring 30 people from my school. I don't even think there are 30 full-time computer science students...
 
but then
 
5:16 PM
smoke break
 
you can't permit heterogenous lookups which don't have implicit conversions.
like, say, unique_ptr.
 
@Crowz Janitors?
 
@MartinJames programmers/database managers
 
so I think I'd have to offer both
 
Xeo
So you have a compile-time and a runtime checked part to it
 
5:17 PM
Sometimes when I am following discussions here all I cant think is: I know some of these words. "heterogenous lookups which don't have implicit conversions." Is that eatable?
 
Do you think if people were taught about how the web works, they would be more cautious on social networking sites?
 
@Xeo Yep. Some heterogenous lookups will need constexpr checking. Others will need run-time checking,
 
Xeo
A tad bit sad, that you need a condition on the heterogenous lookup now, but eh
 
yeah, but there's not much I can do about that
 
@Pawnguy7 No, because not being stupid with your personal info shit is not related to knowing how the web works
 
5:18 PM
the LWG were right that it's plain unsafe the way I had before
in a really bad way.
 
I hate the phrase "tad bit". It's not wrong; it's perfectly valid. I'm just so used to "tad" on its own that the longer form feels wrong to me :(
 
Xeo
@DeadMG yea
Btw. I think there's still a problem
 
spit it
 
Xeo
You said "implicit conversion", right?
 
Oh, Tomalak is back from the cancer room.
 
5:20 PM
yup
those are the original semantics of find.
 
Xeo
Compiler needs to compile both paths of a branch
 
so for me, it's like, "If not heterogenous, then preserve compatibility with existing find".
@Xeo Hence the need for both constexpr and runtime checks.
 
Xeo
So even if your heterogenous returns true, it will attempt the conversion in another path
 
@CatPlusPlus I think there is truth to this statement, but I don't get why people are so surprised, for example: "Hey, how did they post my picture? That was only for my friends, how could they get it" - and it goes on.
 
to that purpose I am now changing the trait.
 
Xeo
5:21 PM
i.e., with your unique_ptr example
Ah, ok.
Well, you could just throw an std::is_convertible next to it, I guess :P
If it's not compile-time checked and isn't convertible - error.
 
yeah
if you need a runtime check, then I need a runtime fallback for if it's not valid.
no
 
Xeo
Oh wait
 
that's not the semantics of the original find.
 
Xeo
We already asserted it's convertible
 
yep
so if you have unordered_map<double>().find(-1L)
it will call the template, and if your std::hash goes to runtime, then if it comes back false, then you will get the same semantics as if this paper was never accepted.
 
Xeo
5:24 PM
Makes sense.
Though implementations might have to jump through a hoop to get the implicit conversion.
if(runtime) return _Het_find(v); else return _Find(v);
Where _Find is not templated
 
they don't have to actually have an implicit conversion, I think, it just needs to be able to be.
I'm not sure that you can get different behaviour from explicitly converting to T from U if T could be implicitly converted to from U.
 
Xeo
Can't just delegate to find because, well, you're in that function right now :P
@DeadMG hmm
I think so
Atleast I could construct an example
 
if you have an example where that's not true then feel free to show me
I can specify an implicit conversion if I want to
 
Xeo
struct X{
    template<class T>
    explicit X(T&&){}

    X(int){}
};
oh wait
That would still call the explicit one, wouldn't it
hmmm
No
sec
 
5:30 PM
@Xeo Your example is valid.
an implicit conversion from double will call X(int), explicit will call X(T&&).
 
Xeo
yeah
 
@LightnessRacesinOrbit A special kind of tomahawk.
 
Xeo
I was testing with int
Which obviously got implicit both times
 
yuppers
 
Xeo
So yeah, make it do an implicit conversion
The question then is, which way.
T u = v; find(u);?
 
5:32 PM
nah
 
Xeo
or find(implicit_cast<T>(v))?
 
your example of _Find and _Het_Find earlier was fine.
 
Xeo
Yeah, that keeps the original semantics the best, I think
Maybe with std::forward and fancies.
 
it's easy for an implementation to just if (!runtime_check<K, T>()(f)) return _Find(std::forward<T>(t));
 
Xeo
ya
 
5:33 PM
hmm
that would require some not too fun metamagics on the part of the implementation, though
I'm effectively calling for a partial spec on the template find.
the upside though is that this is also valid for operator[].
 
Xeo
EnableIf<Or<compile_time_check<K, Unqualified<T>>, is_convertible<T&&, K>>>
 
but in that case, I think that "If not already in map, throw" is better for heterogenous.
 
Xeo
I don't see the need for partial spec?
 
ah yeah
SFINAE should be able to take care of it
 
Xeo
Remember to correctly specify how the types are compared, though
Unqualified for hash_traits, T&& for is_convertible
I think is the best / correct way
 
5:36 PM
the LWG will be much better placed than me to take care of that
 
Xeo
sure
 
Hello
 
-1
Q: Static member function implementation in C++

LXSoftI have a class TV Screen Televizor that contains the following attributes: producer, diagonal and price. After I create this class I create a std::vector of Televizor type, and I need to display them in ascending order according to the requested field (price / diagonal) in a report. The problem i...

 
Xeo
"true, false, CHECK_NOT_FOUND"
 
5:45 PM
yeah, I know
it is true, false, runtime, essentially
 
Xeo
yea
scoped enum?
 
ah yes
 
Is anybody here good with trig stuffs?
 
@LightnessRacesinOrbit Televizor?
Is that like a totally rad television?
 
@EtiennedeMartel Well, I thought so too. But, apparently:
> (*)Televizor means Screen
 
5:47 PM
@melak47 what?
@Cheiron terrible need to develop on a platform that doesn't have C++ compiler, and has some hacky C one only. These compilers don't implement even C properly, though
 
Xeo
@DeadMG: Although with 3 values (aka not bool) you complicate the implementation SFINAE a bit, I think. But shouldn't be much of a problem.
 
Televizor means TV in Spanish.
 
@Rapptz in Polish it' s/v/w/
 
Well in Spanish it's televisor actually
 
Anyway, I need some of you C++ TMP gods willing to spend a few minutes to help me crack something and verify my thinking. @Xeo?
 
Xeo
5:57 PM
?
 
-1
Q: How do I read in inputs into an array in c++?

Jesudas Murugayan#include<iostream> Using namespace std; int main() { int i; char array[5]; for (i = 0; i < 5; i++) { cin >> array[i]; } for (i = 0; i; < 5; i++) { cout << array[i] << endl; } return 0; } This is my code. I face some compilation errors. Please advise.

too localised?
 
@Xeo std::function can't deduce its type from lambda. You already know that, of course. Is there anything, though, to pull call signature from said lambda?
 
@BartekBanachewicz No.
 
Xeo
Don't special-case lambdas~
But yeah, actually, for lambdas you can
 
5:59 PM
not unless you want to change the language so that lambda types include something describing their signature.
 
Xeo
For the current, monomorphic ones.
 
@DeadMG So without user giving me both lambda and a callsign, it's no-no
 
Xeo
@DeadMG &lambda_type::operator() describes the signature well enough
 
Xeo
But see above
 
5:59 PM
yeah. :(
 
Xeo
That's neither extensible nor forward compatible.
 
@Xeo There's no way to know if some T is actually a lambda. You could instead be looking at an existing templated or overloaded operator().
 
I understand the reasoning, I just wanted to make sure that the wall in front of me is rock solid.
crap.
 
Xeo
@DeadMG I know
That's what I said before.
 
indeed
 
Xeo
6:00 PM
It only works if you really really know it's a lambda
 
that's not correct either
 
I like how his name is half Jesus and half Judas
 
lua.register_function<void(void)>([]{ }) seems to be the only option
 
it works for any function object with a non-overloaded non-template operator().
 
Xeo
There's std::signature proposed, but you need call arguments for that
 
6:01 PM
lambdas are not special cases and cannot be special cased
 
Xeo
@BartekBanachewicz Yeah, and I think that's good actually.
 
@Xeo well, @kbok put a lot of effort into parsing function signature to pull stuff we need from it
 
@BartekBanachewicz You could at least try &T::operator().
worth a shot
all existing lambdas will be valid and many function objects too
 
template<typename Ret, typename... Args>
function_wrapper  *make_wrapper(Ret (&function)(Args...)) {
    return new function_wrapper_impl<Ret, Args...>(function);
}
that's his(our) code right now.
 
Xeo
Ew
Give that man a unique_ptr, will ya
 
6:03 PM
raw new with no smart pointer?
 
I used unique_ptr's, but he did stuff his way.
 
but
1 min ago, by DeadMG
@BartekBanachewicz You could at least try &T::operator().
even though it won't work in every case, it will cover a good number of them, both now and in the future.
and don't forget to have an overload for std::function which will already tell you the signature.
 
yes, I know, I now just have to figure out how to write it properly in terms of what we have now
 
Xeo
template<class Sig = try_deduce, class Fty> ... make_wrapper(Fty f);
 
user142019
I'm learning D.
 
Xeo
6:04 PM
And then delegate to class and specialise
 
@Xeo Fty&&?
 
Xeo
> It is best to ban these at compile-time rather than finding out at run-time that they can't be used.
 
Xeo
@DeadMG: Not only can they not be used, they'll still fail at compile-time - but in an "ugh" way.
 
@LightnessRacesinOrbit The OP should be question banned now. :)
 
Xeo
6:06 PM
@BartekBanachewicz Ya, I was thinking simplicity so you don't have to deal with Unqualified<Fty>, but eh
 
@Mysticial Yeah
 
@Xeo I think that the static_assert is just exemplary and the implementation is actually free to enforce the restriction how it wishes.
 
Xeo
@DeadMG Yeah, but I just meant your explanation
 
@Xeo I am afraid that this project is outgrowing me again :<
 
Xeo
unique_ptr<T> and T* will not fail at runtime.
 
6:07 PM
that's why the constexpr version was in
 
Xeo
Right, but I'm still only referring to the text :P
 
right, ok
 
Xeo
> If it is runtime, then static_assert(is_convertible<K, T&&>::result)
Hmm
 
> compile-time if homogenous lookup can't succeed rather than getting an exception at run-time.
superior?
 
Xeo
@DeadMG That's not what I was getting at :(
 
6:08 PM
then what were you getting at?
 
Xeo
My nitpick was that you implied unique_ptr<T> with T* would fail at runtime.
Which it will not
Or atleast the text seemed to imply that
 
hmm
it's not absolutely clear, I guess.
unique_ptr<T> and T* were the example for the previous sentence, they have nothing to do with that sentence.
 
Xeo
Maybe add a split, then
Btw, the assertion is static_assert(is_convertible<T&&, K>::value, "and some text")
or () instead of ::value
 
> The compile-time lookup is necessary not just for performance or simplicity of use, but because some types cannot use the fallback of the existing homogenous find implementation, such as unique_ptr<T> and T*. For types which can't use the fallback at run-time, it is best that the user receive a compile-time error rather than a run-time exception.
 
So confused by lua_pcall and Luajit. If that's what's happening.
 
Xeo
6:13 PM
> but in a heterogenous lookup, insertion is impossible
Why?
Just convert, do normal indexing?
 
r m
I'm having trouble with a d3d debug message, anybody have a minute to lend a hand?
 
@Xeo Convert from my T* to my unique_ptr<T>?
 
Anyone here use LUA? Not sure what binding to use with C++ :/
 
I guess I could convert if implicitly convertible.
 
Xeo
@DeadMG Implicitly convert, obviously.
Just delegate, like find
 
6:14 PM
luabridge, tolua++ and luabind
 
@Grapes oh lol
 
I prefer not to convert if possible.
 
@Grapes neither, obviously
Also, Lua is not an acronym
 
Xeo
@DeadMG Well, it's what happens if you currently do operator[](convertible_type).
 
that's why I'd rather run a homogenous lookup- you can skip the conversion if the object is found.
 
Xeo
6:15 PM
Which is the same reasoning as with find
 
@Xeo An excellent point.
 
fuck lua, it has goto
 
Xeo
OH NOES
GOTO!
GOTO HIDING_SPOT
 
OMAGAWD
 
he's trolling again
 
6:16 PM
well obviously
 
so, any recommendations?
 
nah, really, fuck lua
 
please respond
 
r m
This is the third time I've tried to talk here and nobody has responded, you all have very harsh standards for newcomers
 
@LucDanton responding.
 
6:17 PM
> in a heterogenous lookup, if there is an implicit conversion, use it to insert, else, insertion is impossible, so throw instead if there was no element found. This paper requires of implementations that in a heterogenous lookup on the indexing operator, and the element is found, no conversion shall be performed.
 
@Grapes FYI I am writing one such library atm.
 
@rm Coming more often will make it better
 
a binding?
 
@Grapes yes
 
@rm I already wasted far too much time on D3D debug messages and am very busy right now.
 
6:17 PM
There are a few out there already though,
 
if you come here three times and all you do is request help, expect to be ignored or simply trolled out of the chat- this is not a helpdesk.
 
@Grapes and all of them are bad. That's why I(we) am writing another one.
 
@rm If you come here with interesting or funny stuff, you'll get welcomed. If you come here with C++/whatever questions that belong on SO, you'll get crushed.
 
if lua would written in C++, we wouldn't need a binding
 
Xeo
@DeadMG hmmm ... wait, isn't that the exact opposite of what we just established?
 
6:19 PM
There are a few other scripting languages that are quite good
 
@Abyx Havok rewrote Lua in C++ as Havok Script
It's OpenSource, so you can write it in whatever you want, really.
 
@Xeo That's index operator wording, not find wording.
and it's "Insert if implicit conversion possible"
 
yep. it's better to write whole language than a binding to this piece of shit C
 
Xeo
Why not mimic what you do with find and just static_assert the convertability?
 
Why do you dislike it abyx? I thought it was small, fast and already battle-tested
 
6:20 PM
@Abyx I thought we were talking about VM not "language"
@Grapes disregard him
 
plus it's very popular so it's always easy to find developers
 
Xeo
Also, if it's not convertible, it will still fail at compile-time.
No exceptions
 
typedef Ret FuncType(Args...); WTF @kbok :/
 
Xeo
@BartekBanachewicz What's wtf with that other than FuncType as the name? :P
 
@Xeo he is storing them as raw function pointers. Why no std::function
 
Xeo
6:22 PM
Well, he was only interested in functions until now, so no need for std::function
 
r m
@DeadMG You all are helping each other out, I don't see how that is any different. But clearly none of you are willing to engage with non-regulars
 
@Xeo now read what you wrote :)
 
2 days ago, by Etienne de Martel
In sense, it's like you have to earn your "right to ask" here by becoming part of this little community. If you don't have time for that, or don't care for that, then go on SO instead.
A wise man once said ^
 
Xeo
@BartekBanachewicz When I say "functions", I'm excluding member functions and function objects.
 
@rm The difference is that D3D debug messages are the most fucking annoying shit ever.
 
6:23 PM
@rm most of the time, we're ridiculing each others
 
whereas what we're discussing is not.
> For indexing operator, the selection logic is valid, but in a heterogenous lookup, if no element was found and there is an implicit conversion, use it to convert and then insert as per homogenous lookup. Else, throw an exception. This explicitly requires that in a heterogenous lookup, if the element exists, no conversion is performed.
 
@Xeo welpsgahfh, ok
 
@Xeo
 
Xeo
@DeadMG Wait, what "else" case is there to throw an exception from?
If the element is there, cool. If it's not there, convert and insert.
 
@Xeo Because I don't want to completely remove the possibility, I want to permit it if possible, and since it is possible, then I wish to permit it, as it were.
 
6:25 PM
@rm Perhaps you've misunderstood the purpose of this room. It isn't for answering question, whether or not you're a newcomer
 
@Xeo Else is "Else if no implicit conversion and the element is not found"
 
Xeo
@DeadMG Again: if there is no implicit conversion, you won't even get to the runtime part
It will fail at compile-time that there is no conversion available for the alternate path
 
@DeadMG you've never messed with the OpenGL equivalents, have you? :)
 
@Xeo Ah... yes
 
Xeo
That's what I'm getting at the whole time
 
6:26 PM
@jalf No, but that doesn't make it more attractive to spend my time on the D3D debug messages instead of, say, watching the chair of LWG present the latest in allocators.
 
Xeo
Of course, you could require implementations to tag-dispatch on is_convertible, but it seems rather silly to trade a compile-time assertion for an exception :P
 
@Xeo Just use SFINAE to choose what to do on the alternate path, like insert_if_possible_or_throw(...);.
 
Xeo
Look one message up :)
 
@Xeo Hmmm, I'm not sure that's accurate, because you could have a run-time success.
@Xeo Yeah, sorry. Life's hard on a craptop.
 
r m
@jalf I read the FAQ on asking questions, i'm not trying to waste your time, I've already posted this question on SO and gamedev.net forums but have not received a response in over a day, that's the only reason I came here
but I see now that this is not the right place so I will look for another forum
 
6:28 PM
Godspeed.
 
Xeo
@DeadMG What? Tell me of an implicit conversion that is not possible at compile-time but possible at runtime :s
Or, I hope we're missing each other here.
 
@Xeo You might find the element and not require it in the first place.
 
test.cpp:126:61: note: cannot convert '<lambda closure object>TestCaseFunction_catch_internal_123()::__lambda0{}' (type 'TestCaseFunction_catch_internal_123()::__lambda0') to type 'void (&)()'
 
that's what I'm saying
 
Xeo
@DeadMG That... seems very "meh" as a reason.
 
6:29 PM
if you ban it outright, then you ban all the cases when it might reasonably succeed at run-time.
and I'm not saying that those cover a large area (although I'd rather ask the LWG).
 
Xeo
Yeah, better let them have that descision
 
what I am saying is that it's not a simple "Trade a run-time error for a compile-time one with no loss of functionality".
 
Xeo
Okay, got it
Either statically assert or tag-dispatch and throw on false_type.
 
@rm try improving your SO question. You wont find a bigger community to ask than SO, so if you're not getting an answer there, then the problem is with your question, not with where you're asking.
but feel free to link to your question here. Once. :)
 
No >:(
 
6:32 PM
@Xeo Yeah. I can go both ways, personally.
but, what is very unfortunate is that N3586 had a provision removed
 
r m
I understand, stackoverflow.com/questions/16024597/…, and if you have suggestions on how to better ask I would be thankful
 
Xeo
Which one?
 
the one about modifying the key type of maps after node removal.
 
Xeo
Oh
 
basically, the value_type of maps and such requires the implementation to declare the key as const, so without moving it you can never modify it even if the map no longer requires it to be const to maintain invariants.
 
Xeo
6:33 PM
Well, the key is stored internally as const Key in all implementations I know, so...
 
yeah
 
Xeo
Which I think is really a shame
 
@rm well, for starters you could phrase the title as a question. :) What is it you want to know? What should I know in order to be able to answer?
 
so there's no way to get rid of the const unfortunately.
 
Xeo
As you can't std::move it, ever.
 
6:34 PM
Apparently with Luajit lua_error has a different effect depending on whether it happens in a try block or not.
 
yes, the whole point of N3586 is that you don't even move the node, you just move around pointers and ownership of it.
 
That can't be right. It must be a side-effect of some horrible other thing that is happening.
 
r m
@jalf yes I suppose you're right, the debug message is not enough for a title
 
whereas std::set and std::unordered_set do not have this problem.
they have a non-const value_type, but only provide const access, so you can quite get non-const access to the node if the container doesn't need it to be const anymore.
 
@EtiennedeMartel looks a lot nicer than when I was there :)
 
6:36 PM
> Lua errors can be caught on the C++ side with catch(...). The corresponding Lua error message can be retrieved from the Lua stack.
Why.
 
the ordered containers paper, N3465 I think it was, also got a bit spanked (not so much though)
 
@rm And if you can't get an answer, you might just have to figure it out yourself. Sometimes, that's the only option you have. If you can narrow your code down to a minimal example which reproduces the problem, you might either understand the error better, or if not, at least have some code you can append to your question
 
@LucDanton I do it that way
@LucDanton luajit is wicked
 
@mhorsfall Fortunately I have total immunity to this problem because I took ten minutes to write this: https://github.com/RichardBarrell/snippets/blob/master/improve_yt_comments.user.js ☺
> ten minutes
 
oh hey there. Room.
 
6:40 PM
@Grapes yeah, popular like a php
 
@Abyx let's all write in Abyxscript.. oh wait, it doesn't exist
 
@BartekBanachewicz not yet
 
@Abyx you should team up with Zoidberg. He's an expert in language design
 
It included testing and deployment.
 
0
Q: Maybe I wrote a virus by mistake?

user1939432When I run below code it works until 3 iterations of simple game but after 3rd iteration CPU usage shoots to %90 and dinstantly crashes. Even console is terminated but below programs exe is seen in windows task list. I have to manually delete it for windows CPU to return to %3 ish levels. Do you ...

^^ lolwut
 
6:43 PM
lol
 
People, y u no close.
 
@Rapptz I did
 
Pedantic: that's not a virus — LittleBobbyTables 2 mins ago
^^ 10 in one minute...
That escalated quickly...
 
with only 2 close votes.
 
@Rapptz Sometimes you don't want to be associated with a question in any way.
 
6:46 PM
@LucDanton but community!
 
Hahaha
 
> I use Dev-C++ on windows 7 64 bit machine
^ Then it's not a mistake! He wrote a virus on purpose :)
 

« first day (913 days earlier)      last day (4027 days later) »