mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
52 lines
853 B
D
52 lines
853 B
D
/*
|
|
REQUIRED_ARGS: -HC -c -o-
|
|
PERMUTE_ARGS:
|
|
TEST_OUTPUT:
|
|
---
|
|
// Automatically generated by Digital Mars D Compiler
|
|
|
|
#pragma once
|
|
|
|
#include <assert.h>
|
|
#include <math.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef CUSTOM_D_ARRAY_TYPE
|
|
#define _d_dynamicArray CUSTOM_D_ARRAY_TYPE
|
|
#else
|
|
/// Represents a D [] array
|
|
template<typename T>
|
|
struct _d_dynamicArray final
|
|
{
|
|
size_t length;
|
|
T *ptr;
|
|
|
|
_d_dynamicArray() : length(0), ptr(NULL) { }
|
|
|
|
_d_dynamicArray(size_t length_in, T *ptr_in)
|
|
: length(length_in), ptr(ptr_in) { }
|
|
|
|
T& operator[](const size_t idx) {
|
|
assert(idx < length);
|
|
return ptr[idx];
|
|
}
|
|
|
|
const T& operator[](const size_t idx) const {
|
|
assert(idx < length);
|
|
return ptr[idx];
|
|
}
|
|
};
|
|
#endif
|
|
|
|
|
|
---
|
|
*/
|
|
|
|
unittest
|
|
{
|
|
extern (C++) int foo(int x)
|
|
{
|
|
return x * 42;
|
|
}
|
|
}
|