亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? array.h

?? 游戲開(kāi)發(fā)數(shù)據(jù)結(jié)構(gòu)-Data.Structures.for.Game.Programmers
?? H
字號(hào):
// ============================================================================
// Data Structures For Game Programmers
// Ron Penton
// Array.h
// This is the basic 1D array class.
// ============================================================================
#ifndef ARRAY_H
#define ARRAY_H

#include <stdio.h>

template<class Datatype>
class Array
{
public:

// -------------------------------------------------------
// Name:        Array::Array
// Description: This constructs the array.
// Arguments:   - p_size: the size of the array.
// -------------------------------------------------------
    Array( int p_size )
    {
        // allocate enough memory for the array.
        m_array = new Datatype[p_size];

        // set the size variable
        m_size = p_size;
    }


// -------------------------------------------------------
// Name:        Array::~Array
// Description: This destructs the array.
// -------------------------------------------------------
    ~Array()
    {
        // if the array is not null, delete it.
        if( m_array != 0 )
            delete[] m_array;

        // clear the pointer, just in case we ever modify this.
        m_array = 0;
    }


// -------------------------------------------------------
// Name:        Array::Resize
// Description: This resizes the array to a new size.
// Arguments:   - p_size: the new size of the array.
// -------------------------------------------------------
    void Resize( int p_size )
    {
        // create a new array with the new size
        Datatype* newarray = new Datatype[p_size];

        // if the new array wasn't allocated, then just return
        // and don't change anything.
        if( newarray == 0 )
            return;

        // determine which size is smaller.
        int min;
        if( p_size < m_size )
            min = p_size;
        else
            min = m_size;

        // loop through and copy everything possible over.
        int index;
        for( index = 0; index < min; index++ )
            newarray[index] = m_array[index];

        // set the size of the new array
        m_size = p_size;

        // delete the old array.
        if( m_array != 0 )
            delete[] m_array;

        // copy the pointer over.
        m_array = newarray;
    }


// -------------------------------------------------------
//  Name:         Array::operator[]
//  Description:  gets a reference to the item at given 
//                index.
//  Arguments:    - p_index: index of the item to get.
//  Return Value: reference to the item at the index.
// -------------------------------------------------------
    Datatype& operator[] ( int p_index )
    {
        return m_array[p_index];
    }



// -------------------------------------------------------
//  Name:         Array::Insert
//  Description:  Inserts a cell inbetween two others.
//  Arguments:    - p_item: item to insert
//                - p_index: index to insert at.
// -------------------------------------------------------
    void Insert( Datatype p_item, int p_index )
    {
        int index;
        
        // move everything after p_index up by one cell.
        for( index = m_size - 1; index > p_index; index-- )
            m_array[index] = m_array[index - 1];

        // insert the item.
        m_array[p_index] = p_item;
    }



// -------------------------------------------------------
//  Name:         Array::Remove
//  Description:  Removes a cell
//  Arguments:    - p_index: index to remove.
// -------------------------------------------------------
    void Remove( int p_index )
    {
        int index;

        // move everything after p_index down by one cell.
        for( index = p_index + 1; index < m_size; index++ )
            m_array[index - 1] = m_array[index];
    }



// -------------------------------------------------------
//  Name:         Array::Size
//  Description:  gets the size of the array.
//  Arguments:    None.
//  Return Value: the size of the array.
// -------------------------------------------------------
    int Size()
    {
        return m_size;
    }


// -------------------------------------------------------
//  Name:         Array::operator DataType*
//  Description:  conversion operator, converts array
//                into a pointer, for use in C-functions
//                and other normal array functions
//  Arguments:    None.
//  Return Value: a pointer to the array.
// -------------------------------------------------------
    operator Datatype* ()
    {
        return m_array;
    }


// -------------------------------------------------------
//  Name:         Array::WriteFile
//  Description:  Writes an array to disk
//  Arguments:    The Filename
//  Return Value: true on success, false on failure
// -------------------------------------------------------
    bool WriteFile( const char* p_filename )
    {
        FILE* outfile = 0;
        int written = 0;

        // open the file
        outfile = fopen( p_filename, "wb" );

        // return if it couldn't be opened
        if( outfile == 0 )
            return false;

        // write the array and close thef ile
        written = fwrite( m_array, sizeof( Datatype ), m_size, outfile );
        fclose( outfile );

        // if we didn't write the number of items we expected,
        // return failure
        if( written != m_size )
            return false;

        // return success.
        return true;
    }
    

// -------------------------------------------------------
//  Name:         Array::ReadFile
//  Description:  reads an array from disk
//  Arguments:    The Filename
//  Return Value: true on success, false on failure
// -------------------------------------------------------
    bool ReadFile( const char* p_filename )
    {
        FILE* infile = 0;
        int read = 0;

        // open the file
        infile = fopen( p_filename, "rb" );

        // return if it couldn't be opened
        if( infile == 0 )
            return false;

        // read the array and close the file
        read = fread( m_array, sizeof( Datatype ), m_size, infile );
        fclose( infile );

        // if we didn't read the number of items we expected,
        // return failure
        if( read != m_size )
            return false;

        // return success
        return true;
    }



// -------------------------------------------------------
// Name:        Array::m_array
// Description: This is a pointer to the array.
// -------------------------------------------------------
    Datatype* m_array;


// -------------------------------------------------------
// Name:        Array::m_size
// Description: the current size of the array.
// -------------------------------------------------------
    int m_size;
};




#endif

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
伊人色综合久久天天| 白白色 亚洲乱淫| 国产精品久久久久影院| 在线亚洲免费视频| 懂色av一区二区三区免费观看| 激情综合色播激情啊| 日本人妖一区二区| 久久精品国产在热久久| 国产精品亚洲一区二区三区妖精 | 欧美色综合网站| 在线观看网站黄不卡| 国产精品久久久久久久午夜片| 精品无人区卡一卡二卡三乱码免费卡 | 精彩视频一区二区| 欧美成人伊人久久综合网| 精品国产sm最大网站免费看| 欧美精彩视频一区二区三区| 91精品国产免费久久综合| 欧美刺激午夜性久久久久久久 | 精品国产乱码久久| 国内国产精品久久| 中文字幕视频一区二区三区久| 国产精品毛片高清在线完整版 | 亚洲高清视频的网址| 日本麻豆一区二区三区视频| 精品久久国产97色综合| 国产99久久久久久免费看农村| 国产精品的网站| 欧美日韩在线播放三区四区| 国产亚洲成年网址在线观看| 亚洲va欧美va国产va天堂影院| 成人av电影在线观看| 日韩美女天天操| 99精品一区二区三区| 国产色爱av资源综合区| 欧美日韩一区在线观看| 国产一区二区三区在线看麻豆| 91精品免费在线| 亚洲国产精品视频| 久久五月婷婷丁香社区| 日韩av二区在线播放| 国产精品色哟哟| 精品91自产拍在线观看一区| 欧美无砖砖区免费| 91在线观看一区二区| 欧美α欧美αv大片| 色欧美88888久久久久久影院| 欧美白人最猛性xxxxx69交| 在线看国产一区二区| 国产成人精品1024| 最新久久zyz资源站| 色综合久久中文综合久久牛| 国产馆精品极品| 国产成人三级在线观看| 亚洲精品欧美综合四区| 欧美激情一区二区三区四区 | 国内精品视频一区二区三区八戒| 午夜不卡av免费| 欧美视频在线一区二区三区 | 日韩欧美高清一区| 91精品国产综合久久小美女| 在线视频一区二区三| 色爱区综合激月婷婷| 亚洲成人资源网| 日产欧产美韩系列久久99| 专区另类欧美日韩| 在线不卡中文字幕播放| 日韩区在线观看| 99这里只有久久精品视频| 国产成人综合亚洲91猫咪| 国产麻豆视频一区二区| 成人精品国产一区二区4080| 成人永久aaa| 久99久精品视频免费观看| 狠狠色丁香久久婷婷综| 成人激情动漫在线观看| 欧美体内she精视频| 欧美一级片在线| 中文字幕在线一区二区三区| 亚洲国产欧美在线| 精品夜夜嗨av一区二区三区| www.欧美色图| 久久新电视剧免费观看| 亚洲综合色区另类av| 亚洲日本va在线观看| 久久99这里只有精品| av电影天堂一区二区在线| 7777精品伊人久久久大香线蕉超级流畅| 欧美精品一区二区三区视频| 亚洲精品综合在线| 国产毛片精品视频| 欧美精品日韩一本| 亚洲特黄一级片| 色婷婷久久综合| 精品国产乱码久久久久久牛牛| 亚洲成人免费影院| 99这里只有久久精品视频| 国产天堂亚洲国产碰碰| 裸体健美xxxx欧美裸体表演| 亚洲另类色综合网站| 国产99久久久久| 久久精品亚洲精品国产欧美kt∨| 婷婷六月综合网| 欧美精品久久99| 日日夜夜精品视频免费| 国产精品一二三四| 久久蜜桃香蕉精品一区二区三区| 欧美mv日韩mv亚洲| 韩国精品免费视频| 日韩区在线观看| 国产成人免费在线视频| 国产校园另类小说区| 国产成人av电影免费在线观看| 欧美成人伊人久久综合网| 狠狠色丁香婷综合久久| 国产午夜精品在线观看| 92国产精品观看| 香蕉成人啪国产精品视频综合网 | 日本vs亚洲vs韩国一区三区| 精品一区二区三区免费视频| 国产亚洲一区字幕| 99久久99久久精品国产片果冻 | 亚洲成人自拍偷拍| 日韩精品一区二区三区视频在线观看| 精品一区二区三区在线播放 | 91精品国产乱码久久蜜臀| 久久精品国产精品亚洲红杏| 中文字幕一区二区三区蜜月 | 欧美一区日本一区韩国一区| 精彩视频一区二区三区| 亚洲综合区在线| 国产性做久久久久久| 欧美日韩精品久久久| 亚洲一二三专区| 国产精品久久久久久久裸模| 91 com成人网| 色成年激情久久综合| 国产成人一区在线| 免费成人在线网站| 亚洲在线视频免费观看| 日韩一区欧美一区| 国产日韩欧美亚洲| 精品电影一区二区三区| 欧美女孩性生活视频| 91国模大尺度私拍在线视频| 国产suv精品一区二区883| 全部av―极品视觉盛宴亚洲| 亚洲精品视频观看| 最新国产の精品合集bt伙计| 日韩三级视频在线看| 欧美成人aa大片| 日韩午夜精品视频| 日韩精品资源二区在线| 日韩精品一区二区三区视频| 日韩欧美自拍偷拍| 精品日韩一区二区三区免费视频| 678五月天丁香亚洲综合网| 99久久精品情趣| 国内成人自拍视频| 麻豆精品一区二区| 国产伦精一区二区三区| 国产一区二区看久久| 久久狠狠亚洲综合| 国产又黄又大久久| 国产成人综合在线观看| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 国产ts人妖一区二区| 成人福利视频在线| 欧美日韩一级片在线观看| 在线电影欧美成精品| 精品国产一区二区三区忘忧草| 精品福利一区二区三区| 最新久久zyz资源站| 日韩中文欧美在线| 国产福利91精品一区| 99精品一区二区| 日韩精品一区在线观看| 国产精品视频一二三| 日韩电影在线免费看| 国产成人av影院| 欧美日本在线一区| 日韩美女视频19| 韩国女主播成人在线| 在线观看视频一区| 久久久国际精品| 裸体歌舞表演一区二区| 一本在线高清不卡dvd| 欧美经典一区二区| 麻豆精品在线看| 色婷婷av一区二区| 国产精品久久久久影院亚瑟 | 免费人成精品欧美精品| 91在线精品秘密一区二区| 久久久电影一区二区三区| 石原莉奈在线亚洲二区| 欧美日韩国产精品自在自线| 综合av第一页| 99久久国产综合色|国产精品| 久久久国产午夜精品| 成人免费黄色在线|