Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
26.valarray.members.stdcxx-313.cpp
Go to the documentation of this file.
1
29#include <cassert>
30#include <cstdlib>
31#include <cstring>
32#include <new>
33#include <valarray>
34
35
36void* operator new (std::size_t s) throw (std::bad_alloc)
37{
38 return std::memset (std::malloc (s), 0x55, s);
39}
40
41void operator delete (void *ptr) throw ()
42{
43 std::free (ptr);
44}
45
46
47struct S {
48 const S* const self;
49 S (): self (this) { }
50 S (const S &s): self (this) { assert (&s == s.self); }
51 ~S () { assert (this == self); }
52 S& operator= (const S &s) {
53 assert (this == self && &s == s.self);
54 return *this;
55 }
56};
57
58
59S foo (S s) { return s; }
60S bar (const S &s) { return s; }
61
62
63int main ()
64{
65 const std::valarray<S> a (2);
66
67 a.apply (foo);
68 a.apply (bar);
69}
#define ptr
Definition 17.names.cpp:525
#define a
Definition 17.names.cpp:109
#define s
#define foo(buf, s,...)
#define assert(expr)
Definition _cassert.h:40
const S *const self