1.

//test.h
#include <string>
using namespace std;
struct AA
{
string a1;
string a2;
string a3;
}; class test
{
public:
void ReadString(vector<AA> vv); };
#include "StdAfx.h"
#include "test.h" void test::ReadString(vector<AA> vv)
{
vector<AA>::iterator it;
for (it=vv.begin();it!=vv.end();++it)
{
string ss=it->a1;
} }
void CtttttttDlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here AA aa1;
aa1.a1="aaaa11";
aa1.a2="aaaa12";
aa1.a3="aaa13"; AA aa2;
aa2.a1="aaaa21";
aa2.a2="aaaa22";
aa2.a3="aaa23"; vector<AA> vv;
vv.push_back(aa1);
vv.push_back(aa2); /*vector<AA>::iterator it;
for (it=vv.begin();it!=vv.end();++it)
{
string ss=it->a1;
}
*/ test ts;
ts.ReadString(vv); }

c++ vector struct 使用的更多相关文章

  1. STL map+vector+struct的使用示例

    个人编写的小例子,没有注释,刚毕业时作为技术调研随手编写,仅供参考: #include<iostream> #include<map> #include<vector&g ...

  2. vector it->和*it

    //每次写代码总是被迭代器的iter->和*iter弄晕,主要是被protobuf弄晕了 #include <vector> struct test{ test(){ memset( ...

  3. 3.x vector的用法

    #include<vector> //struct struct GOLD_STRUCT {     Sprite  * goldspSprite;     int goldValue; ...

  4. vector::erase returns incompatible iterator in debug build

    关于std::vector中erase的用法http://www.cplusplus.com/reference/vector/vector/erase/ #include <vector> ...

  5. 用 C++ 标准模板库(STL)的 vector 实现二叉搜索树(BST)

    本文由 Justme0翻译自 Code Project 转载请参见文章末尾处的要求. 介绍 众所周知,要建一棵树,我们需要关注它的内存分配与释放.为了避开这个问题,我打算用C++ STL(vector ...

  6. hdu 4557 非诚勿扰 vector的应用 原来vector 可以删除指定位置元素 不过消耗大

    非诚勿扰 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submi ...

  7. 用邻接表或vector实现存边以及具体如何调用[模板]

    存边: 对于指针实现的邻接表: struct edge{ int from,next,to,w; }E[maxn]; int head[maxn],tot=0;//head初始化为-1: void a ...

  8. 初识STL vector

    写这个主要是当作笔记来写的,配上自己的理解加上一些测试示例; 上代码: #include<iostream>#include<cstring>#include<vecto ...

  9. c++ vector的内存释放

    c++中vector的一个特点是: 内存空间只会增长,不会减小.即为了支持快速的随机访问,vector容器的元素以连续方式存放,每一个元素都挨着前一个元素存储.设想,如果每次vector添加一个新元素 ...

随机推荐

  1. BootStrap学习------栅格

    使用Bootstrap前端框架-栅格 要点 1.使用Bootstrap需要引入的css和js: (1)bootstrap.min.js (2)bootstrap.min.css 2.栅格系统需要通过& ...

  2. 二、oracle pctfree和pctused详解

    一.建立表时候,注意PCTFREE参数的作用 PCTFREE:为一个块保留的空间百分比,表示数据块在什么情况下可以被insert,默认是10,表示当数据块的可用空间低于10%后,就不可以被insert ...

  3. 关于MySQL的SLEEP(N)函数

    都知道通过在MySQL中执行select sleep(N)可以让此语句运行N秒钟: ? 1 2 3 4 5 6 7 mysql> select sleep(1); +----------+ | ...

  4. 黄永成-thinkphp讲解-个人博客讲解25集

    整个网站的根目录用blog你要跟别人说起,自己好识别的文件夹名字. 下面的项目名称 就不再重复的写了, 直接用App就好了. 网站访问: ...../index.php(入口文件)/Admin(模块名 ...

  5. winsow xp不能安装软件, 提示"中断" 是因为设置了 软件限制策略

    原来是我为了优化和安全, 设置了软件限制策略. 我设置的是: secpol.msc中, 设置 "软件限制策略" -> "其他规则"中 , 指定了 c:/d ...

  6. MyBatis动态SQL详解

    MyBatis的动态SQL是基于OGNL表达式的,它可以帮助我们方便的在SQL语句中实现某些逻辑. MyBatis中用于实现动态SQL的元素主要有: if choose(when,otherwise) ...

  7. [译]Profile and debug your ASP.NET MVC app with Glimpse

    原文:http://www.asp.net/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse Gl ...

  8. WCF--提示:异常消息为“传入消息的消息格式不应为“Raw”。此操作的消息格式应为 'Xml', 'Json'。

    Ajax调用WCF服务... 本来用 // $.getJSON("http://localhost:16625/Service1.svc/Article_GetInfo", { } ...

  9. python 爬虫1

    简单访问有道词典的翻译界面,将页面翻译功能简单呈现 import urllib.request import urllib.parse import json content = input(&quo ...

  10. maven 项目配置

    创建java web的maven项目方法有两种,一是先创建maven项目,再选择jdk 和 dynamic web 运行环境 ,二是创建java项目,然后转化为maven项目 1.将普通java项目转 ...