/usr/include/xsd/cxx/auto-array.hxx is in xsdcxx 3.3.0.1-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | // file : xsd/cxx/auto-array.hxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_AUTO_ARRAY_HXX
#define XSD_CXX_AUTO_ARRAY_HXX
#include <cstddef> // std::size_t
namespace xsd
{
namespace cxx
{
template <typename T>
struct std_deallocator
{
void
deallocate (T* p)
{
delete[] p;
}
};
// Simple automatic array. The second template parameter is
// an optional deallocator type. If not specified, delete[]
// is used.
//
template <typename T, typename D = std_deallocator<T> >
struct auto_array
{
auto_array (T a[])
: a_ (a), d_ (0)
{
}
auto_array (T a[], D& d)
: a_ (a), d_ (&d)
{
}
~auto_array ()
{
if (d_ != 0)
d_->deallocate (a_);
else
delete[] a_;
}
T&
operator[] (std::size_t index) const
{
return a_[index];
}
T*
get () const
{
return a_;
}
T*
release ()
{
T* tmp (a_);
a_ = 0;
return tmp;
}
void
reset (T a[] = 0)
{
if (a_ != a)
{
if (d_ != 0)
d_->deallocate (a_);
else
delete[] a_;
a_ = a;
}
}
typedef void (auto_array::*bool_convertible)();
operator bool_convertible () const
{
return a_ ? &auto_array<T, D>::true_ : 0;
}
private:
auto_array (const auto_array&);
auto_array&
operator= (const auto_array&);
private:
void
true_ ();
private:
T* a_;
D* d_;
};
template <typename T, typename D>
void auto_array<T, D>::
true_ ()
{
}
}
}
#endif // XSD_CXX_AUTO_ARRAY_HXX
|