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 2019 15:06

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

  • Jan 24 2019 07:47

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

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

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

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

    ldionne on gh-pages

    Update benchmarks to 490dbf6 fo… (compare)

  • Jan 02 2019 00:33
    ricejasonf closed #434
  • Jan 02 2019 00:33
    ricejasonf commented #434
  • Jan 02 2019 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
Adam Boseley
@aboseley
This looks to work. Is there a better way
template <typename... Types> 
constexpr auto getVariantTypes(std::variant<Types...>&& v){
  return hana::tuple_t<Types...>;
}
Jason Rice
@ricejasonf
There's also Boost.Mp11 mp_rename<Var, hana::tuple>. It depends on what you want to do with the types.
Adam Boseley
@aboseley
I'd like to extract the types out of a std::variant, and put then the equivalent of a hana type list. The mp_rename shuffles the types from the variant to a hana::tuple, but I think I still need to wrap them in a hana::type_c. Which I struggling to do. This is easy to do for boost::variant but there isn't matching support for std::variant that I can see
Jason Rice
@ricejasonf
I suggest not using tuple_t. hana::experimental::types does the same thing without wrapping individuals types in type as that tends to create a lot of unnecessary type instantiations. If all you are doing is type computations then you don't want to use hana::tuple either as that has several member templates that are expensive to instantiate (relatively).
If you really wanted to you could do mp_transform<hana::type, mp_rename<Var, hana::tuple>>>
Adam Boseley
@aboseley
Thanks for the advise!
Adam Boseley
@aboseley
When introspecting on user defined types, is there a way to get back the string "name" of the struct, we pass in as the first to parameter to BOOST_HANA_ADAPT_STRUCT, like we do for each of its members?
Jason Rice
@ricejasonf
no, I think you would have to roll your own macro for that
...or just adding a static-constexpr char const* name manually
Adam Boseley
@aboseley
Thanks again. I've actually been adding a static-constexpr string_view to the parent structure to hold the name. It just duplicates what I'm already passing to the macro, and wanted to make sure I wasn't missing so other hana magic for getting it back.
Enrico Maria De Angelis
@Aster89
Gleb Popov
@arrowd
Just wanted to share your question here, but you already did that.
Enrico Maria De Angelis
@Aster89
@arrowd , my question? :D
Gleb Popov
@arrowd
Yep.
Enrico Maria De Angelis
@Aster89
Good, if I'm lucky someone will offer a bounty on it :D
Enrico Maria De Angelis
@Aster89
@arrowd , I've added a few more bits to the story too
It'd be nice to have Louis Dionne's opinion on it :D
Pavel Krasnopevtsev
@pkrasnop_twitter
I wonder whether it is expected that boost::hana::map equality operator will actually use copy constructor to construct all objects inside it (which is pretty expensive in my case). Apparently this happens because of boost::hana::just which effectively triggers a copy or am I missing something?
Jason Rice
@ricejasonf
Could you post a minimal use case that reproduces this?
Pavel Krasnopevtsev
@pkrasnop_twitter
Enrico Maria De Angelis
@Aster89

Some time ago I tried partially applying std::visit to a visitor in the form of a boost::hana::overload. Clearly std::visit can't be partially applied as it is, because it is a template function, so I first wrapped it in a lambda, like this:

 auto visit = [](auto const& visitor_, auto const&... visited_){
    return std::visit(visitor_, visited_...);
};

and then tried naively with the following

auto visitor = boost::hana::overload(/* list overloads here */);
auto visitWithVisitor = boost::hana::partial(visit, visitor);

which doesn't work. (After some months) I've investigated a bit and come up with an answer to why this happens: overload_t's templated constructor is a better match than the implicitly defined copy constructor when copying a non-const lvalue.

The problem shown above is solved by making visitor const, or by std::moveing it (or more simply by passing it as an rvalue at partial's call site), which is probably just fine anyway.

But still, what about adding overload_t(overload_t cons&) and overload_t(overload_t&) so that the above works?

Dhruva gole
@dhruvag2k:matrix.org
[m]
I maybe in the wrong place, but where can I join to discuss about potential projects for Google Summer of Code?
Jason Rice
@ricejasonf
Not here, but googling it turned up this: https://github.com/boostorg/wiki/wiki/Google-Summer-of-Code:-2021
Hoss Ajallooiean
@katetsu
is there a way to infer return type here:
template<class R, class T>
R foo(T){}

template<>
int foo(bool a){
    return 0;
}

int main() 
{
  std::cout << foo(true) << std::endl;
}