« first day (1690 days earlier)      last day (3484 days later) » 

12:00
@AlexM. Would feeding in a custom ordering predicate do the job?
that's what I'll do
That is, can you compute the priority from the element (or pair of elements if it comes to that).
I have Things that have properties
but some properties are more important for specific things
@AlexM. std::pair<int, YourStuff>
@milleniumbug good point
I forgot about std::pair
erases struct PropertyPrioPair
12:01
If YourStuff has operator<, it will automagically work.
I'll define a comparator for std::pair<Property, int>
That'll work too.
comparator you mean?
englando is hard
Comparer is C# terminology for comparator
12:04
ICompareful
englang
so like std::priority_queue<int> is really just an ordered list of ints
interesting
WTF was in their mind!? @jessewilson how should I sleep now… https://corner.squareup.com/2015/05/okhttp-2-4.html Why Java, why?? http://t.co/X93XKLwmTY
what the actual fuck
@AlexM. If you continously .top(), .pop(), then you'll get an order (that's essentially how heapsort works)
12:08
@AlexM. Not quite
But it otherwise doesn't have an order, it's a heap
right
That's why you can't access other elements than the top
Other than it being a queue
@BartekBanachewicz It's hilarious to put some URLs in set and unexpectedly waiting an eternity for the DNS resolver.
if there are still people who think that functional purity has no value after things like that then I don't know what to say
@AlexM. ah
12:15
URL class making implicit DNS lookups is on the PHP level of cringe-worthiness and derpiness.
@BartekBanachewicz yup
Didn't expect that from Java.
using PropertyQueue = std::priority_queue < std::pair<Property, int>, std::vector<std::pair<Property, int>>, PropPrioPairComparer > ; lmao
so much code
@milleniumbug I wouldn't assume that it does. It might just compare equal ifff the effective IP has been cached
Xeo
Xeo
@AlexM. What's the comparer?
12:16
@BartekBanachewicz ^^ Who says it's doing side effects?
Xeo
Xeo
@sehe That's even worse!
class PropPrioPairComparer
{
public:
	bool operator()(std::pair<Property, int> pair1, std::pair<Property, int> pair2)
	{
		return pair1.second > pair2.second;
	}
};
ikr
@Xeo this
Xeo
Xeo
@AlexM. lol
12:17
should I have used a lambda or sth
Like yesterday, I maintain that the fact that horribul code can be written without it, doesn't make pure FP magically better.
Why can't you use std::pair<int, Property> instead?
I just googled about using prio queue and did the same things I found along the way
@sehe DNS settings change
12:18
@Jefffrey does pair somehow have a default comparer that does pair1.first > pair2.first
@BartekBanachewicz No way. Sherlock, you won the interwebs. Read again my question
@Jefffrey It will work if your Property has operator<
@AlexM. Yes, std::greater<...>
> std::pair uses lexicographic comparison: It will compare based on the first element. If the values of the first elements are equal, it will then compare based on the second element.
I don't think I want this
Why not?
user1804599
12:19
Today is a great day.
@Jefffrey Wrong side
because my properties are enums
user1804599
This is the first time I explicitly handled EAGAIN.
@AlexM. Well that's bad, but not reason
2 mins ago, by Jefffrey
Why can't you use std::pair<int, Property> instead?
12:19
@rightfold Do it EAGAIN tomorrow
@Jefffrey op die fiets
user1804599
:p
@AlexM. Which means they'll otherwise be in unspecified order
let me think about this
Oh noes
Xeo
Xeo
@AlexM. So? If you don't care about their order for equal prioreties (apparently, since you only compare the priorety), it shouldn't matter if they actually have a consistent ordering.
12:20
yea I got it now
So it's using PropertyQueue = std::priority_queue < std::pair<int, Property>, std::vector<std::pair<int, Property>>, std::greater<std::pair<int, Property>>>
Not much better, but at least there's no own predicate.
std::priority_queue<std::pair<int, Property>> Properties;
this should work in that case
Xeo
Xeo
@milleniumbug vector is the default underlying container
oh wait
@Xeo Yes, but comparer is after the container parameter.
Xeo
Xeo
there's the greater still
12:24
but do you need to specify greater
Xeo
Xeo
if you want the smaller prios to be on top...
nvm, it seems the default comp goes the other way around
Xeo
Xeo
if you want the larger prios, the default is right (less)
you could also just make larger prios be the higher prios :P
Sure, you can do that
I wish priority queue was <TElement, TPriority>
12:25
@AlexM. Wrap it :P
Wrap it the fuck up
user1804599
All ordered queues are priority queues.
man I haven't been playing agar.io for at least one week, this is good
maybe I'll start doing clever stuff instead
@Jefffrey I might
right now I don't have the no-duplicates guarantee that I had with unordered_set before
and no easy way to make the intersection of two property queues w/ their priorities
I should be studying now what am I doing
@Veritas are you still interested in why your implementation doesn't compile?
12:30
So you want order and no-duplicates?
yea the end goal is some kind of function
that takes in two Things
@FilipRoséen-refp I do, I didn't have the chance to look more into it yesterday.
and based on their common and uncommon properties, decides how likely it is that thing 1 and 2 are in the same category of things
Added a "best-of-both-worlds" approach that doesn't break encapsulation: Live On Coliru. — sehe 19 mins ago
12:31
I need the priorities because roundness is more important for a ball for example than it is for...
a pizza
I always forget about the implicit friendness of forward declared nested types ^
hm I need that thing
to measure the hole size
That's really handy sometimes
how is it called in english
@BartekBanachewicz If it fits, it's large enough
2
@BartekBanachewicz diameter?
12:33
@BartekBanachewicz this?
no, the thin strips thing
something like this
but it costs less than shipping
@FilipRoséen-refp Got it. I thought I also tested instantiating X beforehand but it appears I didn't.
@BartekBanachewicz Buy it at a local shop?
@R.MartinhoFernandes I wonder if anyone sells them locally
I should learn about allocators
12:35
Thanks a lot. Now waiting for the initializer article.
As in, how to use one from the container perspective
Not how to write one
@BartekBanachewicz gauge?
@Veritas I'm working on it, sadly gcc is being a dick in the butt - and I will have to report a few bugs before publishing the article
@BartekBanachewicz is it useful? Your hardware store should have it
@Veritas I mean, vc++ is always being a dick in the butt - so that will not surprise people - even though it handles things far better than gcc is in relation to the contents of the post
12:37
it's not a generally useful thing
more of a specialty one
You have not accepted an answer to any of your previous questions. stackoverflow.com/help/someone-answersacraig5075 45 mins ago
wow. I thought that manouvre went extinct
I need it to measure the valves' free movement
@FilipRoséen-refp Now that's interesting. What's the basic idea behind it by the way?
without further requirements: coliru.stacked-crooked.com/a/e05640a6cb5a91f9 (you write your own code; SO is there for help when you're stuck) — sehe just now
@BartekBanachewicz sounds like the bike shop might have them
@Veritas (ab)using the fact that copy-initialization can end up causing direct-initialization is certain contexts. The most simple example, that gcc chokes on (but icc, clang, and msvc accepts); struct A { }; struct B { explicit A (A const&); A (B const&); }; having int main () { A x = B {}; }
@Veritas the above should use the converting-constructor A::A (B const&), and then use that temporary to direct-initialize x.
@Veritas however, gcc is (as said) a dick in the butt and complains about the fact that the copy-constructor is explicit (even though it shouldn't)
12:40
@BartekBanachewicz Are you saying that he is wrong there?
Xeo
Xeo
@FilipRoséen-refp I feel like your As and Bs are swapped there
@Jefffrey he's not even wrong
Xeo
Xeo
(and in the snippet above, for the ctors)
@Xeo You construct a B but somehow get an A!
@sehe maybe.
I need to look out
12:41
@Xeo thanks, fixed!
I think I should start taking more care about my bike.
@Veritas anyhow, the incorrect behavior of gcc doesn't affect the solution in the article - but it messes up the explaining of how things work, since I know (assume) people will try the snippets with gcc
I can't iterate over this shit
fuck it
I'll just use a vector and sort it myself
@AlexM. std::set
12:43
Good morning!
12 mins ago, by Alex M.
yea the end goal is some kind of function
@milleniumbug o yea that one is ordered
hmm
@AlexM. I have no idea what that means, but heck; happy hunting!
doesn't allow duplicates though
multi_set if you need that
I don't need duplicates so it's ok
there are so many things in this library jesus
why can't one iterate over a priority queue anyway
it should be equivalent to .dequeue-ing until the end w/ no side effects
Xeo
Xeo
@FilipRoséen-refp That's still all kinds of backwards....
12:47
@Xeo haha yeah, I just realized
@AlexM. That's hard to do with heap
it should be possible with copies
And priority_queue is essentially a heap
Yeah, which would sort
I'm was at the hospital yesterday, got some new (for me) drug due to some weird "semantics" of my heart - I blame that
just make a copy and add some warning for performance stuff or sth if that's the focus
12:48
struct A { }; struct B { explicit B (B const&); B (A const&); }; int main () { B x = A{}; } /cc @Xeo @Veritas
Figured, no worries.
priority_queue doesn't let you invalidate heap invariants, just like std::set doesn't let you modify elements because it would invalidate order.
If you want to risk it, just maintain the heap yourself
There are make_heap and other related functions
And if you want ordered copy, copy and sort it
For what it's worth, you want something more complex than your typical container can provide.
Boost.MultiIndex could do it, but something tells me you can't use it
yep at the end of things I'll write my own PropertyList or something
but right now I just want to get something written
i.e. have a starting point
you can just build your own indices with weak refs and vectors
@FilipRoséen-refp That's horrible though: B x = A{}; is ok, but B x = B{}; is not (assuming B is default-constructible) - fuck C++
12:54
@AndyProwl depends on how you look at it, but sure; C++ is complex.
"Complex" is a euphemism, it's inconsistent
They're both cases where an object of type B is initialized from a temporary of type B, they should behave the same
yay I got my starting point
Thing t("Ball", {
	{ 10, Thing::Property::Round},
	{ 0, Thing::Property::Red }
});
Thing t2("Pizza", {
	{ 2, Thing::Property::Round },
});
assert(Similarity(t, t2) == 1);
time to go study now
It seems that Allocators only provide interface to allocate things of identical size
@AndyProwl I have complained about this in the past, so I'm with you on that one
As in std::allocator<int> can create only chunks of size N*sizeof(int)
12:58
time for a shower. ploff
@milleniumbug OTOH you can always attempt a rebind.
@LucDanton Sure, I wonder if I can rebind to allocator<char>
and allocate whatever I want
For std::allocator that’d work since it required to use one of the global allocation functions IIRC. The allocator concept doesn’t go that far though I think.
0
A: How to get xml file parsed using TinyXml2 in c++ program?

seheIn the troll answer category: Boost Property Tree Live On Coliru #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> struct Person { int age; bool passed; enum Condition { Alive, Dead } condition; friend std::ostream& operator<<(std::ostream&...

my city looks kinda cool
13:02
@BartekBanachewicz What where is that
Looks nice.
Oh I see
I've moved a month ago remember
@BartekBanachewicz Can't stalk you anymore :P
(j/k)
13:02
@milleniumbug was going to ask
it prolly does help that you know my identity but not vice versa
you see ivan memes are the best
I can't parse that.
Oh wait I get it now.
@BartekBanachewicz Heh, I'm not @AlexM. :P
Xeo
Xeo
@AlexM. I always seem to get a chuckle out of those.
@milleniumbug IDGI
13:07
@milleniumbug Oh, even for std::allocator you’ll have to handle alignment.
@BartekBanachewicz Just a joke
if my father would've been born in russia
his name would've been ivan
and I'd be ivanovich because of it lol
so do you think my neighbours will be angry if I use the basement electricity for my server
13:08
Ivanovich M.
Sasha Ivanovich
yes
ur mam
@BartekBanachewicz Do you share that with your neighbors?
share what? electricity?
@BartekBanachewicz Will you be angry if they unplug it?
13:10
it's generally available in the basements
Yeah.
@R.MartinhoFernandes it would be in my basement
Then why would they care?
they'd need to dunno cut the whole power from the basements
I mean, who's paying for that electricity?
13:10
peeps.
it's meant to be used for stuff like tools in the basements
but say you're not supposed to host a washing machine there
tools like servers ?
a server is sort of a gray area
How will they know, anyway?
well someone would notice if you carried the clothes out
as for the server, I'd need to route the ethernet cable somehow
13:12
Would they see the ethernet cable?
I am still not sure whether my apartment is directly above the basement or not
but I think it's like 0.5m to the right
tell them it's a decoration
so I'd need to get through the balcony floor or around the balcony and then into the basement window
You can go wireless if you're feeling adventurous.
lol servers on wifi
no way.
13:13
why not?
Latency.
reliability mostly
latency should be fine
^ yeah that too.
WiFi is fine for mobile phones or occasional lan gaming
Ven
Ven
13:14
> WiFI
> Gaming
or if you have a lot of low-priority devices
@Ven if the router is in the same room you'll get reasonable perf and latency and won't have to hook up all the cables
@Ven Dude, you are playing massive multiplayer gamers over the internet, which is much worse than a modern wifi network.
OTOH MMOs work just fine with 100-150ms ping
shooters don't.
@LucDanton Yeah, that too. The more I read into it, the more it seems that I won't be able to satisfy allocator requirements, and I'll be fighting against the interface more than using it.
For example, .construct for allocator<char> constructs char
well… yeah :D
13:21
Maybe I'll define VariableNodeLengthAllocator concept instead
The other option is to stop allocating everything in one block and make use of two allocators
Yay RTC
Not even sure what kind of joke to make
tradeoffs, tradeoffs
@AndyProwl make joke
Ell
Ell
13:38
Lol
user1804599
0
Q: Why in C++ when i concat a string with '+' like it don't concat but remove first char of the string

Andrea Borii was learning C++ after 6-7 years of java and i have encouter a problem, in this snippet that instead of "concat" it's just remove the n character as the input has been given.. #include <iostream> int main() { int id; std::cin >> id; std::cout << "Hello world!" + id << std::endl; ...

user1804599
lol
he took the bait /cc @sehe
or maybe he didn't
can't quite tell
Hah, he's messing with you.
user1804599
He's better than you as well.
13:48
@AndyProwl natural number integrity (did you move/rename files?)
@sehe I don't know, this is from a colleague
@Nooble lol
@AndyProwl why so negative?
AAAAAAAAYYYYYYYYYYYYY
like that.
@AlexM. lol, well done
user1804599
wooow.. i fell like an idiot.. XD thanx very much =) — Andrea Bori 14 mins ago
user1804599
13:57
how do idiots fall?
Ven
Ven
stupidly

« first day (1690 days earlier)      last day (3484 days later) »