-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcva_list.h
More file actions
47 lines (39 loc) · 1018 Bytes
/
cva_list.h
File metadata and controls
47 lines (39 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include <stdarg.h>
/**
Please note, this class is not at all more safe than to use the
va_list macros directly, it's just a slightly more convenient way
to first start and then subsequently end a va_list.
And please do keep in mind the comment above, just as with va_arg,
the only possible error indication you'd ever get from this class
is a crash because of memory access violation (unless you're using
clr:pure).
*/
#ifdef _MSC_VER
#define Cva_start(name, argument) Cva_list name; va_start((va_list)name,argument);
#else
#define Cva_start(name, argument) Cva_list name; va_start(name,argument);
#endif
class Cva_list
{
public:
#ifdef _MSC_VER
Cva_list(va_list cheatlist):list(cheatlist) {}
#else
Cva_list(va_list cheatlist) { va_copy(list, cheatlist);}
#endif
Cva_list()
{
}
~Cva_list( )
{
}
template<typename type>
type& cva_arg()
{
return va_arg( list, type );
}
operator va_list&(){ return list; }
private:
va_list list;
};