Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
26.valarray.unary.stdcxx-314.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
53 S operator+ () const { assert (this == self); return *this; }
54 S operator- () const { assert (this == self); return *this; }
55 S operator~ () const { assert (this == self); return *this; }
56 bool operator! () const { assert (this == self); return false; }
57
58void operator= (const S &s) { assert (this == self && &s == s.self); }
59};
60
61int main ()
62{
63 const std::valarray<S> a (2);
64
65 +a;
66 -a;
67 ~a;
68 !a;
69}
#define ptr
Definition 17.names.cpp:525
#define a
Definition 17.names.cpp:109
#define s
const minus< T > & operator-(const minus< T > &lhs, const minus< T > &rhs)
void operator+(typename A< T >::I, const A< T > &)
#define assert(expr)
Definition _cassert.h:40
const S *const self