c_cpp vector.h

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp vector.h相关的知识,希望对你有一定的参考价值。

//
// Created by wangzhigang on 2019/4/18.
//
#ifndef BUPT_VECTOR_H
#define BUPT_VECTOR_H

#include <initializer_list>
#include <iostream>

class vector {
    int sz{};
    double *elem{};
public:
    vector(int s);//构造器

    vector(const vector &arg);//拷贝函数,浅拷贝

    vector &operator=(const vector &a); //拷贝赋值,深拷贝

    vector(std::initializer_list<double> lst);//另一种构造器


    ~vector();//析构函数

    int size();

    double get(int n);

    void set(int n, double v);

    double &operator[](int n);//运算符重载
};

#endif //BUPT_VECTOR_H

以上是关于c_cpp vector.h的主要内容,如果未能解决你的问题,请参考以下文章