当前位置: 首页>>代码示例>>C++>>正文


C++ Store::size方法代码示例

本文整理汇总了C++中Store::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Store::size方法的具体用法?C++ Store::size怎么用?C++ Store::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Store的用法示例。


在下文中一共展示了Store::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getCurrentSelection

	DataSnapshot::Ptr getCurrentSelection()
	{
		int row = list.getSelectedRow();
		Store* s = Store::getInstance();

		if (!s || row < 0 || row > s->size()) return nullptr;

		return s->get(row);
	}
开发者ID:SonicZentropy,项目名称:ZenAutoTrim,代码行数:9,代码来源:buffer_visualiser.cpp

示例2: main

int main(int argc, const char *argv[]) {
    cout << endl << "Starting store test..." << endl << endl;

    int size0 = 4 * sizeof(int) + sizeof(size_t);
    char a0[size0];

    size_t *aa = (size_t *) &a0;
    aa[0] = 16;
    int *ab = (int *) &a0[8];
    for (int i = 0; i < (size0 - sizeof(size_t)) / sizeof(int); i++)
        ab[i] = i;

    Block b0 = Block(size0, a0);

    Store<int> *t0 = new Store<int>(b0);

    cout << "t0 size: " << t0->size() << endl;
    for (int i = 0; i < t0->size(); i++)
        cout << "t0[" << i << "] = " << (*((*t0)[i])) << endl;

    cout << endl;

    int size2 = 4 * sizeof(int) + sizeof(size_t);
    char a2[size2];

    size_t *cc = (size_t *) &a2;
    cc[0] = 16;

    int *ca = (int *) &a2[8];
    ca[0] = (*((*t0)[0])) + 1;
    ca[1] = (*((*t0)[1])) + 1;
    ca[2] = (*((*t0)[2])) + 1;
    ca[3] = (*((*t0)[3])) + 1;

    Block b1 = Block(size2, a2);

    Store<int> *testGetFromT0 = new Store<int>(b1);

    cout << "testGetFromT0 size: " << testGetFromT0->size() << endl;
    for (int i = 0; i < testGetFromT0->size(); i++)
        cout << "testGetFromT0[" << i << "] = " << (*((*testGetFromT0)[i])) << endl;

    cout << endl;

    cout << "t0 unchanged: " << t0->size() << endl;
    for (int i = 0; i < t0->size(); i++)
        cout << "t0[" << i << "] = " << (*((*t0)[i])) << endl;

    cout << endl;

    int size3 = 100 * sizeof(int) + sizeof(size_t);
    char a3[size3];

    size_t *dd = (size_t *) &a3;
    dd[0] = 400;
    int *ad = (int *) &a3[sizeof(size_t)];
    for (int i = 0; i < (size3 - sizeof(size_t)) / sizeof(int); i++)
        ad[i] = i;

    Block b2 = Block(size3, a3);
    Store<int> *storeTest = new Store<int>(b2);

    cout << endl;

    int size4 = 10 * sizeof(double) + sizeof(size_t);
    char a4[size4];
    size_t *ee = (size_t *) &a4;
    ee[0] = 80;
    double *ea = (double *) &a4[sizeof(size_t)];
    for (int i = 0; i < (size4 - sizeof(size_t)) / sizeof(double); i++)
        ea[i] = i + 0.1;

    Block b3 = Block(size4, a4);
    Store<double> *doubleTest = new Store<double>(b3);

    cout << "double store: " << doubleTest->size() << endl;
    for (int i = 0; i < doubleTest->size(); i++)
        cout << "doubleTest[" << i << "] = " << (*((*doubleTest)[i])) << endl;

    cout << endl << endl;

    int size5 = 5 * sizeof(float) + sizeof(size_t);
    char a5[size5];
    size_t *ff = (size_t *) &a5;
    ff[0] = 20;
    float *fa = (float *) &a5[sizeof(size_t)];
    for (int i = 0; i < (size5 - sizeof(size_t)) / sizeof(float); i++)
        fa[i] = i + 0.12345;

    Block b4 = Block(size5, a5);
    Store<float> *floatTest = new Store<float>(b4);

    cout << "Float Store Test: " << floatTest->size() << endl;
    for (int i = 0; i < floatTest->size(); i++)
        cout << "floatTest[" << i << "] = " << (*((*floatTest)[i])) << endl;

    cout << endl << endl;

    int size6 = 26 * sizeof(char) + sizeof(size_t);
    char a6[size6];
//.........这里部分代码省略.........
开发者ID:twareproj,项目名称:tware,代码行数:101,代码来源:_store_test.cpp


注:本文中的Store::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。