Welcome to Coding : Sécurité Programmation Réseaux

Search   in  

 Create an Account Home | Submit News Your Account Content | Topics | Top 10  


Accueil
· Home
· Listing des Articles
· Top 10
· Repository des Exploits

Les sujets / parties
· C / C ++
· Visual Basic
· Asm
· Reseaux
· Java
· Securite
· Divers

Utile
· Listing des Articles

· Telecharger
· Le Forum
· Liens
· Proposer un article

Top20 des Downloads
· 1: Etude des reseaux generalites et protocoles
· 2: Cheval de troie en VB avec sources
· 3: Netcat 1.1
· 4: Keylogger
· 5: Etudes des reseaux hauts debits architectures et protocoles
· 6: Ecoute de port
· 7: Etude du Smart Spoofing
· 8: Win Packet Capture Utils
· 9: Tutorial on Traffic Interception on Switched Lan using ARP spoofing
· 10: Cours de C

User Info
Welcome, Anonymous
Nickname
Password
(Register)
Membership:
Latest: gold-os
New Today: 0
New Yesterday: 1
Overall: 2179

People Online:
Visitors: 37
Members: 0
Total: 37

  
Coding : Sécurité Programmation Réseaux: Forums

Coding :: View topic - vector de vector
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

vector de vector

 
Post new topic   Reply to topic    Coding Forum Index -> C / C ++
View previous topic :: View next topic  
Author Message
Bruno Causse
Guest





PostPosted: Fri May 16, 2008 4:10 am    Post subject: vector de vector Reply with quote

bonsoir,

si je cree un vector de vector d'objet

class A;

..../...

std::vector< std::vector<A> > tabA;
//remplissage

je n'ai pas a me soucier de la liberation de tabA (la class A possede bien
son destructeur)

ps: quel est la meilleur facon (ecriture) pour creer un tabA[x][y]; sachant
que A prend obligatoirement un parametre (pas de constructeur par defaut)

j'utilise
//allocation creation

std::vector < std::vector<RXSplit_point> > SplitPointStack;

for(int thread_id = 0; thread_id < MaxNumOfThreads; thread_id++) {

std::vector<RXSplit_point> tmp(MaxActiveSplitPoints);

SplitPointStack.push_back(tmp);

for(int ActiveSplitPoint_id = 0; ActiveSplitPoint_id < MaxActiveSplitPoints;
ActiveSplitPoint_id++)

SplitPointStack[thread_id].push_back( RXSplit_Point(MaxNumOfThreads) );

}

merci
--
Bruno Causse
Back to top
Sylvain Togni
Guest





PostPosted: Fri May 16, 2008 4:10 am    Post subject: Re: vector de vector Reply with quote

Bruno Causse a écrit :

Quote:
je n'ai pas a me soucier de la liberation de tabA (la class A possede bien
son destructeur)

Tout à fait. La classe vecteur, comme toutes les classes normalement
constituées, possède un destructeur qui s'occupe de faire
automatiquement le ménage. Le fait que ce soit un vecteur de vecteur
ne change rien.

Quote:
ps: quel est la meilleur facon (ecriture) pour creer un tabA[x][y]; sachant
que A prend obligatoirement un parametre (pas de constructeur par defaut)

j'utilise
//allocation creation

std::vector < std::vector<RXSplit_point> > SplitPointStack;

for(int thread_id = 0; thread_id < MaxNumOfThreads; thread_id++) {

std::vector<RXSplit_point> tmp(MaxActiveSplitPoints);

SplitPointStack.push_back(tmp);

for(int ActiveSplitPoint_id = 0; ActiveSplitPoint_id < MaxActiveSplitPoints;
ActiveSplitPoint_id++)

SplitPointStack[thread_id].push_back( RXSplit_Point(MaxNumOfThreads) );

À priori ceci devrait être équivalent :

std::vector< std::vector<RXSplit_point> > SplitPointStack(
MaxNumOfThreads,
std::vector<RXSplit_point>(
MaxActiveSplitPoints,
RXSplit_Point(MaxNumOfThreads)));

--
Sylvain Togni
Back to top
Bruno Causse
Guest





PostPosted: Fri May 16, 2008 4:10 am    Post subject: Re: vector de vector Reply with quote

"Sylvain Togni" <"sylvain.togni at visionobjects.com"> a écrit dans le
message de news: 482c581f$0$21144$7a628cd7@news.club-internet.fr...


merci
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Coding Forum Index -> C / C ++ All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.36 Seconds