This file is indexed.

/usr/include/ncl/nxsutilcopy.h is in libncl-dev 2.1.18+dfsg-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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
//	Copyright (C) 2008 Mark Holder
//
//	This file is part of NCL (Nexus Class Library) version 2.1
//
//	NCL is free software; you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation; either version 2 of the License, or
//	(at your option) any later version.
//
//	NCL is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with NCL; if not, write to the Free Software Foundation, Inc.,
//	59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//

// This code is based on code developed by Mark Holder for the CIPRES project
// Much of this file comes from Andrei Alexandrescu "Modern C++ Design"

#if !defined NXS_UTIL_COPY_H
#define NXS_UTIL_COPY_H
#include <algorithm>
#include <cstring>

#if defined(_MSC_VER)
#	undef	HAVE_COMPILE_TIME_DISPATCH
#else
#	define HAVE_COMPILE_TIME_DISPATCH
#endif

////////////////////////////////////////////////////////////////////////////////
///	Int2Type<compile time constant integer> defines a unique (and stateless)
///		class associated with a given integer.  Used for compile time dispatching
///		of function calls or creation of appropriate templated classes.
///
///	defines an unnamed enum "value" that is equal to the integer used to
///		define the class.
///	\author	Andrei Alexandrescu "Modern C++ Design"
//////////

template<int v>
class Int2Type
	{
		public:
			enum {value = v};
	};

typedef Int2Type<true>  TrueAsAType;
typedef Int2Type<false> FalseAsAType;

////////////////////////////////////////////////////////////////////////////////
///	Type2Type<typename> defines a unique (and stateless) class for each type
///		that is specified as the template argument.
///	This is useful in controlling the return type of templated functions in
///		lieu of partial template specialization of templated functions (which is
///		not allowed by the C++ standard)
///	Defines the typedef OriginalType which corresponds to the template argument
///	\author	Andrei Alexandrescu "Modern C++ Design"
//////////

template<typename T>
class Type2Type
	{
		public:
			typedef T OriginalType;
	};


namespace ncl
{
namespace hidden
{
// used by #COMPILE_TIME_ASSERT
template<bool> struct CompileTimeChecker
	{
	CompileTimeChecker(...); //default
	};
// used by #COMPILE_TIME_ASSERT
template<> struct CompileTimeChecker<false>{};
}
}

////////////////////////////////////////////////////////////////////////////////
///	\def COMPILE_TIME_ASSERT(condition, msg)
///	\brief A error-detection macro for asserting that conditions are true at compile time.
///
///	Usage:
///
///		COMPILE_TIME_ASSERT(condition to test, error_clue)
///
///	\note	The error_clue must be one alphanumeric word (no spaces of punctaution).
///	The condition to test must be known at compile time (if not a cryptic message such as "illegal non-type template argument"
///	error will be generated.
///	If the compile time assertion evaluates to false, a message such as "Illegal conversion
///		from ERROR_error_clue to CompileTimeChecker<false> ..." will be generated.
///
///	Implementation Details:
///
///		ncl::hidden::CompileTimeChecker is a boolean-templated class.
///		The constructor of ncl::hidden::CompileTimeChecker<true> accepts any type
///		The the only constructor for ncl::hidden::CompileTimeChecker<false> is the default constructor
///		The macro COMPILE_TIME_ASSERT(condition, msg):
///			1	Declares a dummy class ERROR_msg
///			2	checks if it can instantiate CompileTimeChecker<condition> from an ERROR_msg type object.
///		If the condition is true, the construction will succeed, if not the error message will be generated
///		Note that while the  CompileTimeChecker exists in ncl::hidden:: namespace.  The macro is visible
///		by any file that includes compile_assert.h and the class such as ERROR_msg will be added to the global
///		namespace.
///		The resultign code is not affected by the insertion of COMPILE_TIME_ASSERT because the entire construction
///		is inside a sizeof() so no objects are really instantiated.
///
///	\author	Andrei Alexandrescu "Modern C++ Design"
///
//////////
#define COMPILE_TIME_ASSERT(condition, msg) {class ERROR_##msg {}; (void)sizeof(ncl::hidden::CompileTimeChecker<(condition)>(ERROR_##msg()));}

#if defined(HAVE_COMPILE_TIME_DISPATCH)
template<typename T> struct SupportsBitwiseCopy { enum {kResult = false};	};
template<typename T> struct SupportsBitwiseCopy<T*> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<short int> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<int> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<char> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<long int> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<double> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<unsigned short int> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<unsigned int> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<unsigned char> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<unsigned long int> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<bool> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<wchar_t> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<float> {	enum {kResult = true}; 	};
template<> struct SupportsBitwiseCopy<long double> {	enum {kResult = true}; 	};


//	This file uses tricks discussed in Andrei Alexandrescu's book to
//	implement a call to memcpy for primitive types or any class which
//  has the statement template<> struct SupportsBitwiseCopy<CLASS> {	enum {kResult = true}; 	};
//	because of potential portability issues with TypeList, primitive types are
//	have SupportsBitwiseCopy specialized here by brute force enumeration


class NullType {};

template <typename T>
class TypeTraits
	{
	private :
		template <class U> struct PointerTraits
			{
				enum {kResult = false};
				enum {kCopyWithMemCopy = false};	// only allowing memcpy on bare pointers
				enum {kSizeOfPointee = 0};	// only allowing memcpy on bare pointers
			};
		template <class U> struct PointerTraits<U*>
			{
				enum {kResult = true};
				enum {kCopyWithMemCopy = SupportsBitwiseCopy<U>::kResult};
				enum {kSizeOfPointee = sizeof(U)};
			};
		template <class U> struct PointerTraits<const U*>
			{
				enum {kResult = true};
				enum {kCopyWithMemCopy = SupportsBitwiseCopy<U>::kResult};
				enum {kSizeOfPointee = sizeof(U)};
			};
	public:
		enum {kIsPointer = PointerTraits<T>::kResult};
		enum {kCanUseMemCpyOnPointee = PointerTraits<T>::kCopyWithMemCopy};
		enum {kPointeeSize = PointerTraits<T>::kSizeOfPointee}; //only valid if kIsPointer !!
	//	typedef PointerTraits<T>::PointeeType  PointeeType;
	};

template<class T, class U>
class Conversion
	{
	public:
		enum {kSameType = false};
	};

template<class T>
class Conversion<T,T>
	{
	public:
		enum {kSameType = true};
	};

template<class T>
class Conversion<const T*,T*>
	{
	public:
		enum {kSameType = true};
	};

template<class T>
class Conversion<T*, const T*>
	{
	public:
		enum {kSameType = true};
	};

enum CopyAlgoSeclector
	{
		kConservative,
		kFast
	};

template <typename InIt, typename OutIt>
inline OutIt CopyImpl(InIt first, InIt last, OutIt resultP, Int2Type<kConservative>)
	{
	return std::copy(first, last, resultP);
	}

template <typename InIt, typename OutIt>
inline OutIt CopyImpl(InIt first, InIt last, OutIt resultP, Int2Type<kFast>)
	{
	return (OutIt) std::memcpy(resultP, first,  ((std::size_t) (last - first)) * sizeof(*first));
	}

template <typename InIt, typename OutIt>
OutIt ncl_copy(InIt first, InIt last, OutIt resultP)
	{
		enum { kUseMemCpy =(TypeTraits<InIt>::kIsPointer &&
							TypeTraits<OutIt>::kIsPointer &&
							TypeTraits<InIt>::kCanUseMemCpyOnPointee &&
							TypeTraits<OutIt>::kCanUseMemCpyOnPointee &&
							int(TypeTraits<InIt>::kPointeeSize) == int(TypeTraits<OutIt>::kPointeeSize)) ? kFast : kConservative};
		return CopyImpl(first, last, resultP, Int2Type<kUseMemCpy>());
	}

#else //HAVE_COMPILE_TIME_DISPATCH

template <typename InIt, typename OutIt>
inline OutIt ncl_copy(InIt first, InIt last, OutIt resultP)
	{
	return std::copy(first, last, resultP);
	}

#endif //HAVE_COMPILE_TIME_DISPATCH


//adds an element from the first -> last array to the corresponding element in the result array
template <typename InIt, typename OutIt>
inline OutIt ncl_iadd(InIt first, InIt last, OutIt resultP)
	{
	for (; first != last; ++first, ++resultP)
		*resultP += *first;
	return resultP;
	}

//adds each element in resultP array with the correcpsonding element from the first -> last array
template <typename InIt, typename OutIt>
inline OutIt ncl_imult(InIt first, InIt last, OutIt resultP)
	{
	for (; first != last; ++first, ++resultP)
		*resultP *= *first;
	return resultP;
	}


#endif