by

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
Jeff Trull
@jefftrull
@ricejasonf was that a response to my question or just an unrelated comment :)
Jason Rice
@ricejasonf
@jefftrull It was a response to your question. The "early exit" you speak of is not supported by Boost.Hana.
Jason Rice
@ricejasonf
As for looping, for_each is good for side effects. fold is slow to compile but returns a result. unpack is the best if you can make it work with parameter pack expansion.
Jeff Trull
@jefftrull
Ah thank you.
I could throw an exception though, right?
That's the kind of strategy I've seen people employ
It's not one I recommend, but it's one I've seen people employ :)
Enrico Maria De Angelis
@Aster89
Hi all. boost and hana newbie here! :)

Upon trying to compile the following simple code

#include <boost/hana.hpp>
int main() {
  boost::hana::any a = 'x';
}

with this command

g++ -Wunused-value -std=c++2a main.cpp

I get this error (the warning seems well expected):

main.cpp: In function ‘int main()’:
main.cpp:4:19: error: expected ‘;’ before ‘a’
    4 |   boost::hana::any a = 'x';
      |                   ^~
      |                   ;
main.cpp:4:16: warning: statement has no effect [-Wunused-value]
    4 |   boost::hana::any a = 'x';
      |   ~~~~~~~~~~~~~^~~
Being the code barely 4 lines, I think I'm really doing some stupid mistake, but I have no clue at the moment
Jason Rice
@ricejasonf
Hello. hana::any is not a type but an instance of a function object of type any_t.
It's an algorithm to determine whether a Searchable contains any True values.
Perhaps you are looking for boost::any in boost/any.hpp.
Erik Zenker
@erikzenker
Since C++17 there is also an std::any (see here: https://en.cppreference.com/w/cpp/utility/any)
Enrico Maria De Angelis
@Aster89
@ricejasonf , thank you. I mistakely changed the scope when I was playing with the example here.
However, it still to quite clear to me why the code does not work yet. I think I have to read that page a bit better.
Hoss Aja
@katetsu
Hi, i cant manage to compile the set of files above
constantly getting
function 'apply' with deduced return type cannot be used before it is defined
any idea whats wrong and how to fix it?
Jason Rice
@ricejasonf
main.cpp has to know the return type of your apply function
The interface for serialize is very concrete. Perhaps that should be what you implement in the other cpp file
You could use type erasure for your Person object to map to the serialize function
This library does that with a DSL for making concept maps: https://github.com/ldionne/dyno
(or you can just manually make the functions which might be easier)
Hoss Aja
@katetsu
Thanks. but even when i fully remove serialize, i get other errors
duplicate symbol 'boost::hana::curry_detail::curry_or_call<0ul>'
how can main know the return type of apply?
Jason Rice
@ricejasonf
Keep in mind that to use functions across translation units, the compiler must know the function types up front.
right now it can't
That's why I suggested making the interface around serialize. something like : void serialize(stream&, Person const&);
well.. you could figure out the return type and explicitly state it in the interface
but it would be a big nasty tuple or something (sorry I closed the files already)
Hoss Aja
@katetsu
Yes, that what i saw
Jason Rice
@ricejasonf
that kind of defeats the purpose of metaprogramming though
Hoss Aja
@katetsu
so whats the solution?
Jason Rice
@ricejasonf
serialize
or don't try to hide the implementation in a cpp file
Hoss Aja
@katetsu
that makes sense. i was just trying to replicate the code form here
with the only difference being splitting apply
i moved serialize but still getting errors for dup symbols
Jason Rice
@ricejasonf
What version of Boost.Hana? I thought someone mentioned that there was a fix for that
Hoss Aja
@katetsu
1.69
the main reason im using the guts of the BOOST_HANA_DEFINE_STRUCT is so that i dont redefine apply - this is fixed in 1.72
Erik Zenker
@erikzenker
Hey, I am trying to store references from a parameter pack inside a hana tuple. This works well with C++17 fold expressions and std::ref when the parameter pack has at least one element. But it fails with zero elements. I prepared the full example here: https://cppx.godbolt.org/z/52EuWL. Did someone used fold expressions with make_tuple before?
Erik Zenker
@erikzenker
Solved it! The fold expression was wrong. It works with std::ref(t)... instead of (std::ref(t),...).
Abhishek Mahakal
@Master-Chief1
Hello everyone, I am Abhishek Mahakal, currently in 3rd year of computer engineering. I am thrilled to be a part of Boost C++ community and contribute to it!