U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » _pick understanding
_pick understanding [message #26369] Tue, 27 April 2010 21:08 Go to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi there,

in
http://www.ultimatepp.org/srcdoc$Core$pick_$en-us.html

there is _pick explained as
#define _pick const


but when i look in code the _pick definition in MSC environment is empty.. why? setting it to const there as well compiles well..
is there any thing special to MSC to consider? just out of curiosity..

Defs.h:277
#ifdef COMPILER_MSC
#define pick_
#else
#define pick_ const
#endif


another question:

Topt.h:252
template <class T, class B = EmptyClass>
class DeepCopyOption : public B {
public:
	friend T& operator<<=(T& dest, const T& src)
	{ if(&dest != &src) { (&dest)->T::~T(); ::new(&dest) T(src, 1); } return dest; }
	friend void DeepCopyConstruct(void *dest, const T& src)
	{ ::new (dest) T(src, 0); }
	friend T *DeepCopyNew(const T& src)
	{ return ::new T(src, 0); }
};


uses 1 for param in <<= operator while link above also states that the second int parameter is just for distinciton and ignored. is it evaluated anywhere? maybe to indicate a reuse??

IMHO _pick should be explained a bit better, i understand the problem leading to _pick solution, but especially the explanation
Quote:


C++ disallows binding temporaries to non-const references - and that is unfortunately just the thing we need to do here, as we need to change the source temporary returned from a function.


should be visualised by a (not permitted) code snippet as well.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FEATURE: T* ArrayIndex::Detach(int i) AND mini fix
Next Topic: what about VectorBiMap / ArrayBiMap ?
Goto Forum:
  


Current Time: Thu Sep 17 04:13:16 GMT+2 2026

Total time taken to generate the page: 0.00620 seconds