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 #60703 is a reply to message #60702] Thu, 25 July 2024 09:32 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
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;
};


[Updated on: Thu, 25 July 2024 09:32]

Report message to a moderator

 
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:08:30 CEST 2025

Total time taken to generate the page: 0.03524 seconds