Home » U++ Library support » U++ Core » HELPER: Value grouping to ValueArray
HELPER: Value grouping to ValueArray [message #29800] |
Thu, 18 November 2010 10:10  |
 |
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
hi all,
here comes a ArrayCtrl like grouper of Values to a ValueArray, returned as Value itself.
maybe its of help for someone..
since a variable arguments list is suboptimal in c++, this is definitely a better solution in general. good work who ever did this for ArrayCtrl..
syntax:
Value ToValueArray(const Value& [, const Value& ]...);
inline Value ToValueArray(const Vector<Value>& v)
{
return ValueArray(Vector<Value>(v, 0));
}
inline Value ToValueArray(Vector<Value>& v)
{
return ValueArray(v);
}
//$-Value ToValueArray(const Value& [, const Value& ]...);
#define E__ToValueArray(I) Value ToValueArray(__List##I(E__Value));
__Expand(E__ToValueArray)
#undef E__ToValueArray
#define E__Addv(I) v << p##I
#define E__ToValueArrayF(I) \
Value ToValueArray(__List##I(E__Value)) { \
Vector<Value> v; \
__List##I(E__Addv); \
return ValueArray(v); \
}
__Expand(E__ToValueArrayF)
CONSOLE_APP_MAIN
{
Value v = ToValueArray(123, "Hallo", 23.0);
RLOG(v);
}
[Updated on: Thu, 18 November 2010 10:12] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 23:57:38 CEST 2025
Total time taken to generate the page: 0.00940 seconds
|