Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 15:06

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

  • Jan 24 07:47

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

  • Jan 23 02:04
    pthom commented #432
  • Jan 18 12:46

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

  • Jan 16 22:27
    ricejasonf commented #434
  • Jan 05 06:22
    ricejasonf commented #330
  • Jan 03 11:40

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

  • Jan 02 00:33
    ricejasonf closed #434
  • Jan 02 00:33
    ricejasonf commented #434
  • Jan 02 00:04
    ricejasonf opened #434
  • Dec 27 2018 13:11

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

  • Dec 22 2018 11:56
    pthom commented #432
  • Dec 22 2018 11:55
    pthom commented #432
  • Dec 21 2018 15:48
    pthom synchronize #432
  • Dec 21 2018 09:19
    sdebionne opened #433
  • Dec 21 2018 00:08
    ricejasonf commented #432
  • Dec 21 2018 00:03
    ricejasonf commented #432
  • Dec 20 2018 23:36
    pthom commented #432
  • Dec 20 2018 23:36
    pthom commented #432
  • Dec 20 2018 23:13
    ricejasonf commented #432
Louis Dionne
@ldionne
auto tuple = hana::make_tuple(1, 2, 3);
auto view = hana::make_view(tuple); // mutable view

auto const ctuple = hana::make_tuple(1, 2, 3);
auto cview = hana::make_view(ctuple); // view-over-const, not mutable
That's the spirit, I need to test more.
And it should be possible to have stuff like views over optionals, etc.
Jason Rice
@ricejasonf
Why don't views have their own tags? Is there not a penalty for all of the overloading in each function impl?
Louis Dionne
@ldionne
The idea is that view should be a data type of its own, and you never actually create a view with something like sliced, etc..
You only create a view withmake_view, and then pretend it’s a normal container and use normal algorithms on it.
Louis Dionne
@ldionne
BTW, I’m sure there’s a compile-time cost for these overloads, but I’ll prefer cleanliness of interface over compile-time speed unless the speed is really bad
Jason Rice
@ricejasonf
I'm curious about that clang built-in you made for nth-element on packs. Did that ever get merged in? Would it be feasible to make something like that for the construction of detail::hash_table? Even if it wasn't canonical clang it would be cool to have a "distro" with built-ins added specifically for optimizing hana internals.
Louis Dionne
@ldionne
Yes, it’s in Clang trunk AFAICT.
Jason Rice
@ricejasonf
cool!
Louis Dionne
@ldionne
Yeah
We should actually be using it in the implementation
Jason Rice
@ricejasonf
It'll be neat to see the performance change when it is added.
lmk
Louis Dionne
@ldionne
Actually, I just checked and I’m not sure where we would be using it in the current scheme. Indeed, what we need more is a builtin to get the nth element of a parameter pack, not just a type parameter pack.
iolojz
@iolojz
Hi everyone. Maybe a stupid question, but where do I file bugs against boost::hana? On https://svn.boost.org/trac/boost/newticket I am unable to find a 'hana' component...
Nevermind, found it ^^
Jason Rice
@ricejasonf
@iolojz @ldionne I have a fix for #304. Once make check is finished I'll submit a PR.
Louis Dionne
@ldionne
@ricejasonf Damn it, I also had a patch in the works.
Jason Rice
@ricejasonf
same thing?
Louis Dionne
@ldionne
Pretty much, but let’s keep yours.
See my comment on the PR
Adi Shavit
@adishavit
Hi folks, @ldionne

A question about Hana:
Say I want to incrementally collect data in a tuple (or an equivalent heterogeneous container), i.e. incrementally add another value (and type) to the tuple.

I could use std::tuple_cat but I would need to copy and store the result in a different local variable for each such cat.

I can’t use std::any since I won’t know the contained type. Is there such a way to extract the contained type of an any?

Is it possible to have a single local variable that supports such "insert"s preferably without copying?

Does Hana have such a facility?

One obvious way to do this is to incrementally serialize the data (e.g. to json) and reparse it later, but this seems a bit roundabout.

Adi Shavit
@adishavit
I’ve made some more clarifications in the SO question.
Jason Rice
@ricejasonf
@adishavit If you have to make the tuple incrementally there is no getting away from the copy/move of each element each time you append. You could definitely get rid of the "clutter" of moved from objects by breaking each of those //... operations into separate functions. IMO large multipurpose functions are a bit of a no-no anyways. :coffee:
The only reason you would need to make a tuple incrementally is if each of those operations depended on the results of the previous operations.
Adi Shavit
@adishavit
It actually might.
The reason I wanted this is to collect data for later serialization e.g. to csv or json.
I wanted to serialize or the end and not throughout the process.
Leon washbrook
@LeonWashbrook_twitter
James Brock
@jamesdbrock
wow I just saw Hana for the first time, it's awesome, congratulations @ldionne .
Scott Santucci
@ScottFreeCode
Does the BOOST_HANA_DEFINE_STRUCT macro support giving the struct members default values? Or would I have to use regular structs and the BOOST_HANA_ADAPT_STRUCT macro?
Jason Rice
@ricejasonf
I doubt the macro supports it. not at my comp to check tho
Scott Santucci
@ScottFreeCode
Also, I'm sort of trying to reverse the serialization example -- read in data (at runtime) and use it to set the value of the field that matches the key if there is a matching key in the struct; is this sort of thing possible? I'm a little stuck on checking for or comparing against a runtime string instead of a hana::string; I eventually tried a comparison using find_if and a predicate that uses .c_str(), but that didn't work (gave an error that doesn't really say anything meaningful to me and I'm not sure which part of the infodump is relevant). Any pointers (pun not intended)?
[edits for clarity]
Jason Rice
@ricejasonf
I did this in my project nbdl with jsoncpp. dont remember how i dis the equals check
*did
Scott Santucci
@ScottFreeCode
Jason Rice
@ricejasonf
yes it doesnt use hana::Struct but its the same concept
Scott Santucci
@ScottFreeCode
Aaah.
Interesting; I will see if I can find what it's doing. Thanks.
Scott Santucci
@ScottFreeCode
I think I might be able to do it with an ordinary runtime loop instead of a Hana algorithm (I suspect the root of my problem is that the Hana functions all act at compile-time) provided I can find a way to get the length of the accessors list... or have a way to convert the accessors list into a runtime list that would have a length available.
Aha -- hana::length(Foldable) ought to do it? Let me fiddle with the code and see.
Hmm, that won't quite work -- I can only get the accessor at a given index if the index is a compile-time variable.
Jason Rice
@ricejasonf
I'm not sure what you mean. Do you have a code snippet to show?
Hana functions do not necessarily run at compile-time, but the length of a hana::Foldable is known at compile-time. You shouldn't need to put it in a run-time list.
Scott Santucci
@ScottFreeCode
Let me see if any of my half-baked attempts is still in the undo history over here...
Scott Santucci
@ScottFreeCode
So, I expect this to fail on line 36, but it fails on line 29. http://melpon.org/wandbox/permlink/NGxu6Xcs3LjwiBut
Scott Santucci
@ScottFreeCode
(Of course, I really can't tell what the error message means. So it's entirely conceivable that I'm just doing something wrong C++-wise?)