« first day (1594 days earlier)      last day (3580 days later) » 

user1804599
@sehe it prints all fields but the first one, which cat does not.
@LightnessRacesinOrbit Not arbitrary but not always representative neither. Anyways, thanks for the heads up, this place is way too distracting for me to stay much longer! :) Have a nice day/evening.
@LightnessRacesinOrbit Try writing it in idiomatic C++.
@BartekBanachewicz You wouldn't. It's a different paradigm.
@ChristopherC and you
@LightnessRacesinOrbit Okey, translate it to C++'s paradigm then.
13:03
@BartekBanachewicz Why?
user3010322
@ParkYoung-Bae I'm about to be super duper ultra crazy interested in something like this in the near future.
Is this a "it's better than C++ therefore it's 'sexy and amazing'" argument?
@LightnessRacesinOrbit Because if you don't agree with my assessment that the code is great, surely you might have a better solution in mind. I'm curious to see it.
@BartekBanachewicz Your "surely" clause is illogical. I don't know where you pulled that idea from.
user1804599
aaaaaaaaaaaaaa sort in Jinja2 is unstable
13:04
But I don't have time for your strawmanning today
@LightnessRacesinOrbit So you don't consider it "sexy in amazing", but on the other hand you have no other way that you'd personally consider "sexy and amazing"?
@BartekBanachewicz Yes.
user1804599
Protip: sort should be stable, and unstable_sort should be unstable.
@LightnessRacesinOrbit Ah well, next time don't even bother pinging me, then.
@BartekBanachewicz What?!
13:05
6 mins ago, by Lightness Races in Orbit
@BartekBanachewicz Not really.
@BartekBanachewicz Yes, I remember writing that.
So you're only able to handle opposing opinions when accompanied by a ready-made alternative solution. Interesting.
i need a set with non-constant iterators
anyone knows of an implementation of that?
doesn't really make sense
@LightnessRacesinOrbit Yes. In general, when accompanied by something of interest to me that would make me learn something new.
it is like the 3 time i need that in a month
13:06
@BartekBanachewicz You are immune to learning anything new. It's pointless trying.
@gnzlbg remove and insert a new one vOv
@LightnessRacesinOrbit Then stop pinging me altogether.
user1804599
@gnzlbg store a set of pointers to iterators.
If you can't bother to respond with anything meaningful, don't respond at all and don't waste my time. Bye.
@BartekBanachewicz Why?
@BartekBanachewicz loooool
@BartekBanachewicz i have to: find the element, make a copy using the const iterator, erase the element, reinsert it
i want to mutate it in place in such a way that the order is preserved
it seems nuts to have to go through all that trouble
user1804599
Write a function that does it.
@gnzlbg you can't
user1804599
Problem solved.
13:08
the mutation can change the order, duh.
@BartekBanachewicz you can't what?
@BartekBanachewicz unless when it doesn't, duh
@gnzlbg there's the insert with hint, sec
user1804599
Insert with hint prints the following hint to stderr: "use Haskell instead."
@Theorem yeah. Well, understandable if people don't particularly like the style, no
Xeo
Xeo
13:09
@BartekBanachewicz Hint is ignored on all common implementations, IIRC.
user3010322
@Xeo No way, really?
@райтфолд yay. what obfuscation. What happened to cut -f2- :)
user1804599
@sehe I don't know cut.
user3010322
I thought if hint as the end iterator, it would just perform an insertion and do no search?
user1804599
13:09
I do know AWK.
struct A { String name; Data data; };
struct cmp { bool operator<(A const& a, A const& b) { return a.name < b.name; } };
using my_set = set<A, cmp>;
the code would be s.emplace(mutator(*it)); I suppose
sets with custom comparision functions are useless with that facility
@райтфолд my condolences
user3010322
I must test.
13:10
This is fun
3-4) Amortized constant if the insertion happens in the position just after the hint, logarithmic in the size of the container otherwise. (until C++11)
3-4) Amortized constant if the insertion happens in the position just before the hint, logarithmic in the size of the container otherwise. (since C++11)
wow. that's evil
@BartekBanachewicz that could work, i still have to make a useless copy tho
Viral Shah has invited you to join Room for Viral Shah and Alex M.. See your invitations.
this should be good
user1804599
I should not write Hexapoda in Eiffel.
just wait, imma go...
... viral
13:11
:D
@gnzlbg If you could move out of the set, though...
YEEEEEAAAAAH
user1804599
I should write it in a combination of Z shell, Perl and AWK.
@BartekBanachewicz i can't only const_iterators...
user3010322
@AlexM. 6/10 I smiled.
13:11
s.emplace(mutator(std::move(*s.find(k))));
@BartekBanachewicz no, that doesn't work
what is mutator?
@BartekBanachewicz you can't move from const objects though
@sehe mutator(key) -> new_key
user1804599
13:12
@BartekBanachewicz you can't move from const objects though. const&& is a bit lame
1 min ago, by Bartek Banachewicz
@gnzlbg If you could move out of the set, though...
@BartekBanachewicz find returns a const_iterator, note that.... set::iterator is a const_iterator....
in Room for Viral Shah and Alex M., 1 min ago, by Alex M.
yes, lesser being, what do you wish to request of me?
I think I may have intimidated him
@BartekBanachewicz you cannot move out of a const object.
13:13
@BartekBanachewicz oh dreamy code. best code
@gnzlbg well no shit.
Xeo
Xeo
What happened to that proposal that allowed unlinking nodes?
@BartekBanachewicz i could const cast the shit out of it
Xeo
Xeo
@gnzlbg don't
@Xeo joking :p
13:13
You need a way to guarantee your mutation won't change the order
Xeo
Xeo
The key is genuinely declared as const, which would invoke UB if const_cast'ed and changed.
@BartekBanachewicz "if the mutation changes the order it is undefined behavior"
@gnzlbg use mutable members and or use boost::multi_index_container with modify/replace
@gnzlbg fuck UB, express it in types
@CatPlusPlus overall nice. Seems a bit redundant to provide a user guide for chat in general, but if it is going to be there, should probably be kept separate from 'our ways of doing things'
13:14
you should be able to prove that statically
even if we had concepts, and you had a TotalOrder concept, that concept is syntactic, and any type that implements the syntax models it, so you cannot express it in types
even worse, the concept is not opt-in
user1804599
Python eats drunk man alive in India Python Interpreter.
user1804599
lol waht
user3010322
@райтфолд I wonder why nobody cut the drunk man out of the snake.
that would be cruel to the snake
user1804599
13:15
In India cows are sacred and pythons are scared.
user3010322
I wouldn't mind being unholy for the rest of my life.
see my comment above, you cannot
you would need a run-time assert
what if you stored a pointer-to-member as key
and used std::map
13:16
@BartekBanachewicz who tells you that the pointer doesn't alias another pointer of the set after mutation?
ah shit no keys can't inspect values
comparator can't take the key and look at the associated value, but if it could
Xeo
Xeo
@BartekBanachewicz At that point, use a set with a custom comparator.
though you then also can't change the "value" :P
and that useless
@Xeo uh that's the point lol
Well okay what if you stored just pointers
because you might want to change a part of the value, so that the custom comparator result doesn't change
which is what im trying to do
13:18
std::set<unique_ptr<T>>
herp derp
@BartekBanachewicz wrap map :D
i still can set a unique_ptr to another of the set
using release..
Xeo
Xeo
Okay, since I didn't follow from the beginning - what exactly are you trying to do?
see that's the kind of the bullshit you get when you use mutable structures hlurb blurb haskell
i have a set of a struct { variant, name }
and the stuff is in the set sorted using a custom comparator by name
i want to modify the variant in place
it doesn't alter the order
thats it in a nutshell
right now i have to copy the key out, erase the key, and insert a modified key back int
and i ran into the issue 3 times in the last 1-2 months already, so i would like to know if there is a better way to do that
or a boost::container::set with an unsafe_insert
13:21
@gnzlbg just make it a map. Or struct element { mutable value; key_type key; /*...*/ };
then i have the key twice
once in the struct, and once in the map
No. Read again. Also, boost::multi_index_container
what i would need is an intrusive map
that takes the key from my struct
That's another thing you can use. But it has const_iterators (surprise) - citing Boost Intrusive AFAIR
lol
seriously, isn't it a recurrent problem to need to do this?
13:23
Yes. Which is why map is a thing. And you can have multi_index_container
but in map you cannot reuse the key right?
or can you specialize some get_key non-member function to get the key from within your struct?
3
A: want to efficiently overcome mismatch between key types in a map in Boost.Interprocess shared memory

seheYou can use a custom comparator struct MyLess { template <typename T, typename U> bool operator()(const T&t, const U&u) const { return t<u; } }; In your code you can just typedef it as StringComparator UPDATE To the comments Multi Inde...

reuse the what
@gnzlbg huh?
@gnzlbg It's called first_type std::pair<K const,V>::first - just a member variable
map stores the keys anyway, i was thinking of a customization point within map, that allows you to tell it where to get the keys from, but i guess that would make it intrusive, and you would always need to store the keys
13:25
BOOST MULTI_INDEX_CONTAINER
Damn. I linked you an answer that exactly emulates std::map but using customization points to tell it where the key resides.
Lol
@sehe nice post
:D
i cannot read and argue at the same time, sorry :P
thanks for the link :)
user3010322
Always upboat sehe answers.
13:26
@gnzlbg It's ok. Cheers
user3010322
I wonder if there's a way to have implicit conversions in C...
@sehe i'll live with making a copy, erasing, mutating copy, reinserting, yours it's a nice solution, but an extremely complicated solution to an easy task.
it feels like there should be an unsafe member function to do that
7 mins ago, by gnzlbg
and i ran into the issue 3 times in the last 1-2 months already, so i would like to know if there is a better way to do that
but there isn't so shit happens
^ it's not a lot of effort then
You can hide the whole lot. Abstraction is key to managing complexity
13:29
@sehe yes, now i know, it is just not good enough, it isn't performance critical, and i would have to explain why i'm just not using a set on the interface but a "boost weird thingy"
not anyones fault really, maybe the standards comitte
Huh. Did you benchmark that so fast? Impressive
@sehe it would use less memory
Anyways, use intrusive sets anyways. Mucho faster in all likelihood (now that's a "boost weird thingy")
than a map, and it wouldnt require resorting twice on mutation
@gnzlbg "it"?
13:30
your approach with boost multi index
Thanks anyways, I appreciate it.
user1804599
I wonder if you can set the file to read in a BEGIN block in AWK.
@gnzlbg yes. And allows many other goodies, among which: expressive mutation api, heterogeneous key lookup (saves you the time to coerce the lookup key into the right kind of std::string)...
if i wanted performance i would be using a flat_set probably from boost, and would just copy-paste-it and add an unsafe_mutate_in_place member function
boost::vector already has an unsafe default construct elements
Depends an awful lot on access patterns
yes
13:33
so erm... in layman's terms... what's the difference between geometry and tessellation shaders? They both seem to be about adding 'more'... except geometry shader can output less... also seems like they differ in the amount of data they work on... but like, what's the meaningful difference?
for not so often insertions, and lots of reads i would use that
Me too. What's stopping you?
i have few reads, few writes, and its side logic that just has to be as simple as possible, as few lines as possible, and "just" work
thats why i wanted a simpler way to do it than:
it = .. find;
assert not at end;
copy = mutate(*it);
erase it;
insert copy;
user3010322
@thecoshman Geometry shaders take already-computed triangles.
@thecoshman geometry shaders are mostly for removing unwanted primitives or outputting things that require knowledge about full primitive, while tesselation shaders create vertices dynamically
user3010322
13:38
And they can output 0+ triangles.
user3010322
Yeah, what bartek said.
user3010322
Tessellation doesn't take vertices as input. It takes <stuff>.
@BartekBanachewicz isn't it the other way around?
user3010322
@gnzlbg Nope.
@BartekBanachewicz Both can add vertices though... docs say that T shader is better, but G shader can add stuff
13:39
Patches, namely.
user3010322
Geometry Shader comes after Tessellation shader explicitly for this reason.
@ThePhD i use geometry shaders to create vertices dynamically
user3010322
@gnzlbg Right, but the input is vertices.
@ThePhD yes
There's a hard limit and huge perf penalties for outputting new vertices in geom shaders
13:40
the docs say something abut g-shaders can add more information... like if you want to render something multiple times
user3010322
GL_PATCH'd shit doesn't work with Geometry Shaders
for example in a voxel engine you can store only the center coordinate of each voxel, and create the corner points in a geometry shader
i don't know how fast that would be tho, but we are talking about factor 8 less memory requirements for the voxel geometry
Tesselation shaders create meshes with varying amounts of detail that's easily controllable
Basically geom shading pipeline isn't prepared for that
oooh, so like... if you wanted to have a huge hightmap, you could have it 'rendered' with huge triangles, but the tesselation shader could be used to enhance the detail the close tot he camera...
Yep
I have an example that renders a sinusoidal plane
Posted it here a few months ago
user3010322
13:44
Tessellation shaders are meant to generate HUGE amounts of polygons. Geometry Shaders are meant to give a fairly fixed amplification (or even reduction) of geometry.
Mostly reduction
man, for uni I worked on a height-map thing that had level of detail for each section controlled on distance from player. It would have each 'tile' have a vertex buffer for the entire thing, then swap out the index buffers based on how close they are to the player.
sounds like tes shader would have been a lot better
user3010322
Given a single input, you can dump thousands of new triangles from the Tessellation shader.
user3010322
Geometry shader, not so much.
And by thousands he means really thousands
13:45
so just draw two triangles, and have this huge height map generated
with very precise details all over the place :D
Well you need to supersample and shit
well... where needed
@gnzlbg Why the hell would you copy the implementation just to add that? o.O
Free functions are the shit: rough draft (even with overassuming, exceedingly expensive "paranoia" DEBUG checks)
could a T shader do things like work out that a the 'other side' of a hill can't be seen, so no need to generate it's triangles? Or are you better to let the geom shader do that?
Whay a nightmare - only two coffes and I find I'm still in the PHP room:(
user3010322
13:46
Geom shader does that better.
user3010322
Geometry shaders can reject primitives a lot faster and easier than tessellators can.
@MartinJames with bailey around corner?
try{ if (d < 0){ throw NoRealRoots("Determinant is less than zero.");}}
do i have some serious misunderstanding here? it seems NoRealRoots is undefined
@chmod711telkitty Dogs are not allowed in the PHP room, only bitches :)
13:48
bitches are a sub set of dogs :p
@MartinJames PCP room would be funnier
[searches for PCP room..]
but can a G shader reject stuff that is blocked by others things faster than a T shader can NOT produce it in the first place?
@Meraj99 Define it then.
@milleniumbug um, like exception NoRealRoots;?
user3010322
13:49
@thecoshman That'd require your T-Shader to, after generating stuff, also sit down and decide to throw things out.
user3010322
Which is the exact responsibility of the GShader.
@chmod711telkitty Nice line there!
user3010322
You'd have to be able to ask it "where in the generation am I?"
@Meraj99 Exceptions are classes. This should be written in your C++ book.
thinking of like a height map now...
user3010322
13:50
And then you're fucked, because that fast generation algorithm with that tight loop is now branching conditionally, which is the absolute worst operation ever asides from looping (in terms of what GPUs can do efficiently in parallel).
can you control how the T shader works? Like can you say 'start generating from where the player is'?
@chmod711telkitty OK, I bow to you greater experience...
user3010322
@thecoshman You can control these parameters by setting GL_PATCH calls and having the desired LoD sent down with your stuff. That's like the very first use case of tessellation shaders.
@MartinJames You're in shape today hehe
13:53
@Rerito Actually, I feel quite out-of-shape: too many pints of Lancaster Bomber.
To me, the main problem with beer bashing would be a bladder overflow
right so. Well, I'll be playing around with this shit a bit more at some stage I hope :D
it's pretty fun but you need to take a lot of stuff into account later
when you're doing all of those parallax mapping and tesselation and whatnot, probably with deferred rendering
I like the idea of using a 'tessellation map' to help bring out more details, like for dry stone walls
Am I right in thinking that you could use them to even cut hole in 'solid' materials?

« first day (1594 days earlier)      last day (3580 days later) »