Files
amscppnarray/include/amscppnarray/amscppnarray.hpp
madrocketsci 89210c99cb update
2025-05-08 12:32:57 -04:00

66 lines
1.4 KiB
C++

#ifndef __AMSCPPNARRAY_HPP__
#define __AMSCPPNARRAY_HPP__
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <new>
#include <initializer_list>
#include <thread>
namespace ams
{
namespace narray
{
typedef int64_t narray_size_t;
static const int narray_success = 1;
static const int narray_failure = -1;
//problem size at which to begin using threaded operations
static const narray_size_t narray_thread_sz = 5000;
//maximum number of threads to use
static const int narray_max_threads = 50;
template<typename T> class narray
{
public:
narray_size_t length;
T *data;
narray();
narray(const narray<T>& other);
narray<T>& operator=(const narray<T>& other);
narray<T>& operator=(const std::vector<T>& other);
narray(const std::initializer_list<T> initlist);
~narray();
int resize(const narray_size_t newlength);
T& operator[](const narray_size_t ind);
const T& operator[](const narray_size_t ind) const;
T& at(const narray_size_t ind);
const T& at(const narray_size_t ind) const;
void clear(); //erases all elements, sets size to 0
void setall(const T& val); //sets all elements to val
//Comparators
//Operations
};
void test_narray1();
}; //end namespace narray
}; //end namespace ams
#include <amscppnarray/amscppnarray_impl.hpp>
#endif