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
Jason Rice
@ricejasonf
hana::value should return the contained std::size_tso I would think that would work
Maik Klein
@MaikKlein
didn't work with hana::value
only with decltype()::value
Jason Rice
@ricejasonf
oh because it is not constexpr when you call it with the parameters I guess
Maik Klein
@MaikKlein
but I call it like this
  constexpr auto t = hana::tuple_t<int, char, double>;
  constexpr auto is = indices_of(t, hana::decltype_(1.0), hana::decltype_(1));
well c++ is has it's weird parts, I guess
Jason Rice
@ricejasonf
yeah, inside the function the parameters are not considered constexpr
Maik Klein
@MaikKlein
hm k
Jason Rice
@ricejasonf
Which, I think, is probably why integral_constant even exists.
Maik Klein
@MaikKlein
for decltype()::value?
Jason Rice
@ricejasonf
Yeah because it stores the value as a static constexpr
This is not necessarily better, but you could also do something like hana::template_<std::index_sequence>(hana::value(foo)...)
... I think I haven't actually tried it.
Maik Klein
@MaikKlein
how do I access an element of a tuple again? like std::get<0>(t); but in hana?
without hana literals
Jason Rice
@ricejasonf
hana::at(list, hana::int_c<0>) or hana::at_c<0>(list)
Maik Klein
@MaikKlein
hm
Maik Klein
@MaikKlein
haha okay I accidentally created a basic_tuple and I couldn't use at on it
Maik Klein
@MaikKlein
Does C++17 offer anything that will improve build times? Besides modules?
Jason Rice
@ricejasonf
wrt to my use of hana::template_ above I forgot you can only give it hana::types and it returns a hana::type
Plus it still wouldn't work with raw integrals.
Louis Dionne
@ldionne
@ricejasonf Regarding the issue that I get above with Clang (read of non-constexpr variable), and that you didn’t get with Clang 3.8: I can indeed confirm that Clang trunk does not give an error. I think this is a bug, and it should error out. I don’t even know how it manages to compile it, and what code it generates… The compiler is very very smart if it can compile that.
Jason Rice
@ricejasonf
Apparently it is aware that it is empty and has the default constructor so it doesn't try to call it. ??
I wonder if the C++ standard says anything about that.
Louis Dionne
@ldionne

Apparently it is aware that it is empty and has the default constructor so it doesn't try to call it. ??

The compiler would have to be very clever to take this into account during semantic analysis.

Jason Rice
@ricejasonf
BTW @MaikKlein http://boostorg.github.io/hana/index.html#tutorial-appendix-constexpr has info about using arguments inside constexpr functions.
Jason Rice
@ricejasonf
@ldionne Maybe it is assuming not side effects because it does not appear in the function body.
Louis Dionne
@ldionne
I would say this is just a regression and they are not emitting the proper diagnostic anymore.
Jason Rice
@ricejasonf
#include <iostream>

struct Noisy
{
    Noisy() { std::cout << "Noisy: constructed\n"; }
    Noisy(const Noisy&) { std::cout << "Noisy: copy-constructed\n"; }
    Noisy(Noisy&&) { std::cout << "Noisy: move-constructed\n"; }
    ~Noisy() { std::cout << "Noisy: destructed\n"; }
};

struct Silent { };


template<typename T>
constexpr int hello(T const) {
    return 0;
}

int main() {
   constexpr int x = hello(Silent{}); 
   constexpr int y = hello(Noisy{}); 
}
only fails for y
Louis Dionne
@ldionne
Of course, because Silent{} is implicitly constexpr. 1 minute
Jason Rice
@ricejasonf
oh
Yeah, if I add a constructor to Silent it explodes.
Jason Rice
@ricejasonf
    Silent silent{};
    Noisy noisy{};
    constexpr int x = hello(silent);
    constexpr int y = hello(noisy);
Louis Dionne
@ldionne
Yes, now that’s what should trigger the bug.
Clearly, y cannot be evaluated at compile-time
I think that is material for a bug report.
#include <iostream>

struct Noisy {
    Noisy() { std::cout << "Noisy: constructed\n"; }
    Noisy(const Noisy&) { std::cout << "Noisy: copy-constructed\n"; }
    Noisy(Noisy&&) { std::cout << "Noisy: move-constructed\n"; }
    ~Noisy() { std::cout << "Noisy: destructed\n"; }
};

struct Silent {
    constexpr Silent() { }
};

template <typename T>
constexpr int f(T) { return 0; }

int main() {
    Noisy t{}; // not constexpr
    constexpr int result = f(t);
}
Uh, well that’s pretty much a copy-paste of what you wrote above.
Anyway, do you want to fill a bug report against Clang, or shall I do it%
Jason Rice
@ricejasonf
You can if you want.
Louis Dionne
@ldionne
Ok.
Jason Rice
@ricejasonf
That last snippet doesn't trigger the bug though does it?
Louis Dionne
@ldionne
No, no.
I’ll give a link to the report when I’m done
Jason Rice
@ricejasonf
cool
Louis Dionne
@ldionne
Ahah! Actually, a constexpr copy constructor is still created.
But that copy constructor does not do anything, i.e. it does not read from the non-constexpr object.
So I’m thinking that the behavior is correct here.
But if you add a member to Silent, it should error out. I’m going to try.