Date: Fri, 2 Aug 2024 22:22:54 +0200
pt., 2 sie 2024 o 21:36 organicoman <organicoman_at_[hidden]> napisał(a):
>
>
>
>> I do not ask about other solutions, I ask about your code and your "solution".
>> You previously said that `std::any` can't solve your problem. Now you say
>> then `std::any` IS solution for your problem. This means you have no idea
>> what your problem is and only handwave some code around.
>
> I didn't say my proposal is about solving std::any problems,
> I gave you the std::any challenge to take you step by step to understand the proposal,
> You posted a template solution that doesn't cover the proposal,
> then i gave you the challenge of signal/slots just as the next step to understand the discussion.
You do not prove first that you understand this discussion yourself.
People here guide you to understand how C++ work and how it should work
but as far I see this is fruitless.
I personalty exact from you precisely problem that will be solved by your
"solution" but as I see this is pointless too.
> Plus if you were following the thread, they asked me many times, "what is this proposal useful for",
> and i answered many times "it was not my main motivation but a side discovery",
Ok, then whole discussion is pointers as your "solution" do not solve
anything worthwhile.
Goal of C++ is solve real life problems not some "theoretical challenges".
> then i gave the example of signal/slot on top of my head.
> You must be attentive otherwise you will fall in misunderstanding.
You should take that suggestion yourself.
>> > The advantage of my approach, is that it is more effecient and safe.
>
>> My template solution has exactly the same properties that (aka safe
>> and effectinet)
>> I proved it on your's example that you showed previously.
>> You did not contradict my proof.
>
> It works, and it was super, why should i contradict it?
> But it was missing the point.
>
What point? Changing language and type system becasue "we can"?
>> I ask again, can you show me code that can't be solved
>> by current template metaprogramming? Show exactly code and problem
>> that fails to do it.
>
> Already answered
You do not.
As you fail to provide my very simple request of some concrete code examples,
because of this I do not see point in continuing this discussion, I
was hopping naively that
asking you for it would enlighten you in understating this problem.
But as we all see this was pointless endeavor.
Some times tunnel vision is unbreakable.
I wish you good day.
>
>
> >
> > Sent from my Galaxy
> >
> >
> > -------- Original message --------
> > From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
> > Date: 8/2/24 9:40 PM (GMT+04:00)
> > To: organicoman <organicoman_at_[hidden]>
> > Cc: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>, std-proposals_at_[hidden]
> > Subject: Re: [std-proposals] Function overload set type information loss
> >
> > pt., 2 sie 2024 o 18:35 organicoman <organicoman_at_[hidden]> napisał(a):
> > >
> > >
> > >
> > > Lest be charitable and assume you mean this code:
> > >
> > >
> > > ```
> > > template<typename T>
> > > void foo() { cout <<typeid(T).name()<<endl;}
> > >
> > > auto useType(effdecltype(foo) f)
> > > {
> > > using T = __get_ortho_at__<0>(f);
> > > f();
> > > return T(0);
> > > }
> > >
> > > template<typename T>
> > > void consumeType(T t)
> > > { cout << typeid(t).name(); }
> > >
> > > int main()
> > > {
> > > vector<effdecltype(foo)> vec;
> > > vec.push_back(&foo<int>);
> > > vec.push_back(&foo<double>);
> > > vec.push_back(&foo<float>);
> > > for(int i=0; i<5; ++i)
> > > vec.push_back(&foo<char>);
> > > for(const auto& F: vec)
> > > consumeType(useType(F));
> > > }
> > > ```
> > >
> > >
> > > It can be easy fixed by helper:
> > >
> > >
> > > ```
> > > template<typename T>
> > > void consumeTypeHelper()
> > > {
> > > foo<T>();
> > > return consumeType(T{});
> > > }
> > >
> > > int main()
> > > {
> > > vector<void(*)()> vec;
> > > vec.push_back(&consumeTypeHelper<int>);
> > > vec.push_back(&consumeTypeHelper<double>);
> > > vec.push_back(&consumeTypeHelper<float>);
> > > for(int i=0; i<5; ++i)
> > > vec.push_back(&consumeTypeHelper<char>);
> > > for(const auto& F: vec)
> > > F();
> > > }
> > > ```
> > >
> > > Done. Problem fixed in C++11
> > >
> >
> >
> >
> >
> >
> > > Very good... nice try.
> > > Unfortunately you miss the point.
> > >
> > > I showed a loop over a set of functions returning many types.
> > > Imagine you have a container of slots, which returns different types ( i already said that many times)
> > > Given the current state of C++ you can store them only as. Let say.
> > > vector<std::any(*)(int, double)>
> > > How can you tell what type the called function returned before it was hiden inside std::any?
> > > Is it clear?
> > >
> > >
> >
> > Then show this code, I fixed your "example", now show code that can't
> > be fixed in the same way.
> > If you can't write it, then its means this code can't exist and is not
> > a real life problem.
>
>
>
>> I do not ask about other solutions, I ask about your code and your "solution".
>> You previously said that `std::any` can't solve your problem. Now you say
>> then `std::any` IS solution for your problem. This means you have no idea
>> what your problem is and only handwave some code around.
>
> I didn't say my proposal is about solving std::any problems,
> I gave you the std::any challenge to take you step by step to understand the proposal,
> You posted a template solution that doesn't cover the proposal,
> then i gave you the challenge of signal/slots just as the next step to understand the discussion.
You do not prove first that you understand this discussion yourself.
People here guide you to understand how C++ work and how it should work
but as far I see this is fruitless.
I personalty exact from you precisely problem that will be solved by your
"solution" but as I see this is pointless too.
> Plus if you were following the thread, they asked me many times, "what is this proposal useful for",
> and i answered many times "it was not my main motivation but a side discovery",
Ok, then whole discussion is pointers as your "solution" do not solve
anything worthwhile.
Goal of C++ is solve real life problems not some "theoretical challenges".
> then i gave the example of signal/slot on top of my head.
> You must be attentive otherwise you will fall in misunderstanding.
You should take that suggestion yourself.
>> > The advantage of my approach, is that it is more effecient and safe.
>
>> My template solution has exactly the same properties that (aka safe
>> and effectinet)
>> I proved it on your's example that you showed previously.
>> You did not contradict my proof.
>
> It works, and it was super, why should i contradict it?
> But it was missing the point.
>
What point? Changing language and type system becasue "we can"?
>> I ask again, can you show me code that can't be solved
>> by current template metaprogramming? Show exactly code and problem
>> that fails to do it.
>
> Already answered
You do not.
As you fail to provide my very simple request of some concrete code examples,
because of this I do not see point in continuing this discussion, I
was hopping naively that
asking you for it would enlighten you in understating this problem.
But as we all see this was pointless endeavor.
Some times tunnel vision is unbreakable.
I wish you good day.
>
>
> >
> > Sent from my Galaxy
> >
> >
> > -------- Original message --------
> > From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
> > Date: 8/2/24 9:40 PM (GMT+04:00)
> > To: organicoman <organicoman_at_[hidden]>
> > Cc: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>, std-proposals_at_[hidden]
> > Subject: Re: [std-proposals] Function overload set type information loss
> >
> > pt., 2 sie 2024 o 18:35 organicoman <organicoman_at_[hidden]> napisał(a):
> > >
> > >
> > >
> > > Lest be charitable and assume you mean this code:
> > >
> > >
> > > ```
> > > template<typename T>
> > > void foo() { cout <<typeid(T).name()<<endl;}
> > >
> > > auto useType(effdecltype(foo) f)
> > > {
> > > using T = __get_ortho_at__<0>(f);
> > > f();
> > > return T(0);
> > > }
> > >
> > > template<typename T>
> > > void consumeType(T t)
> > > { cout << typeid(t).name(); }
> > >
> > > int main()
> > > {
> > > vector<effdecltype(foo)> vec;
> > > vec.push_back(&foo<int>);
> > > vec.push_back(&foo<double>);
> > > vec.push_back(&foo<float>);
> > > for(int i=0; i<5; ++i)
> > > vec.push_back(&foo<char>);
> > > for(const auto& F: vec)
> > > consumeType(useType(F));
> > > }
> > > ```
> > >
> > >
> > > It can be easy fixed by helper:
> > >
> > >
> > > ```
> > > template<typename T>
> > > void consumeTypeHelper()
> > > {
> > > foo<T>();
> > > return consumeType(T{});
> > > }
> > >
> > > int main()
> > > {
> > > vector<void(*)()> vec;
> > > vec.push_back(&consumeTypeHelper<int>);
> > > vec.push_back(&consumeTypeHelper<double>);
> > > vec.push_back(&consumeTypeHelper<float>);
> > > for(int i=0; i<5; ++i)
> > > vec.push_back(&consumeTypeHelper<char>);
> > > for(const auto& F: vec)
> > > F();
> > > }
> > > ```
> > >
> > > Done. Problem fixed in C++11
> > >
> >
> >
> >
> >
> >
> > > Very good... nice try.
> > > Unfortunately you miss the point.
> > >
> > > I showed a loop over a set of functions returning many types.
> > > Imagine you have a container of slots, which returns different types ( i already said that many times)
> > > Given the current state of C++ you can store them only as. Let say.
> > > vector<std::any(*)(int, double)>
> > > How can you tell what type the called function returned before it was hiden inside std::any?
> > > Is it clear?
> > >
> > >
> >
> > Then show this code, I fixed your "example", now show code that can't
> > be fixed in the same way.
> > If you can't write it, then its means this code can't exist and is not
> > a real life problem.
Received on 2024-08-02 20:23:06