Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » How to mark std::array<T, N> moveable if only T is moveable
Re: How to mark std::array<T, N> moveable if only T is moveable [message #60706 is a reply to message #60703] Thu, 25 July 2024 17:32 Go to previous messageGo to previous message
busiek is currently offline  busiek
Messages: 70
Registered: February 2011
Location: Poland
Member
mirek wrote on Thu, 25 July 2024 09:32
mirek wrote on Thu, 25 July 2024 09:19

Another thing to consider: Tuple is moveable if all its components are moveable. Are we able to express that somehow? (If not, no big deal, I can make Tuple moveable and request that elements are).


Figured it out:


struct not_moveable {};

template <class A, class B>
class Two : std::conditional<is_moveable<A> && is_moveable<B>, moveable<Two<A, B>>, not_moveable>::type {
	A a;
	B b;
};




But what if one wants to use std::tuple instead of Upp::Tuple? How to mark it moveable if tuple components are moveable?
I sometimes prefer to use std::tuple because one can write:
auto [a, b] = some std::tuple

Alternatively, there is a way to implement Upp::Tuple that it works with structured binding?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Copy the content of a SortedVectorMap
Next Topic: SMTP not working
Goto Forum:
  


Current Time: Thu Aug 07 22:09:28 CEST 2025

Total time taken to generate the page: 0.00727 seconds