Click here to Skip to main content
15,886,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: array => vector Pin
Stephen Hewitt17-Jun-10 14:57
Stephen Hewitt17-Jun-10 14:57 
GeneralRe: array => vector Pin
VeganFanatic17-Jun-10 15:10
VeganFanatic17-Jun-10 15:10 
GeneralRe: array => vector Pin
Stephen Hewitt17-Jun-10 15:45
Stephen Hewitt17-Jun-10 15:45 
GeneralRe: array => vector Pin
VeganFanatic17-Jun-10 15:46
VeganFanatic17-Jun-10 15:46 
GeneralRe: array => vector Pin
VeganFanatic17-Jun-10 15:58
VeganFanatic17-Jun-10 15:58 
AnswerRe: array => vector Pin
Aescleal17-Jun-10 22:18
Aescleal17-Jun-10 22:18 
Questioninheriting std::vector Pin
VeganFanatic17-Jun-10 8:26
VeganFanatic17-Jun-10 8:26 
AnswerRe: inheriting std::vector Pin
Aescleal17-Jun-10 9:12
Aescleal17-Jun-10 9:12 
The general concensus is don't inherit from an STL collection - they're not designed for it.

The two ways I'd recommend going about extending an STL collection is either bundle it up in another class (which you've done) OR just write free functions to do the extended functionality. From your example it looks like you want a geometric vector and not a collection of doodads that might or might not have some geometric relationship.

Incidentally if you want to continue using containment the way you have make the std::vector private. You really don't want a class exposing data through it's public interface, it's really hard to test and some idiot will maul it for you - even if that idiot turns out to be you several months down the line when you've forgotten what you did.

Cheers,

Ash
GeneralRe: inheriting std::vector Pin
VeganFanatic17-Jun-10 9:15
VeganFanatic17-Jun-10 9:15 
AnswerRe: inheriting std::vector Pin
Chris Losinger17-Jun-10 9:14
professionalChris Losinger17-Jun-10 9:14 
GeneralRe: inheriting std::vector Pin
VeganFanatic17-Jun-10 9:18
VeganFanatic17-Jun-10 9:18 
GeneralRe: inheriting std::vector Pin
Chris Losinger17-Jun-10 9:22
professionalChris Losinger17-Jun-10 9:22 
GeneralRe: inheriting std::vector Pin
VeganFanatic17-Jun-10 9:25
VeganFanatic17-Jun-10 9:25 
GeneralRe: inheriting std::vector Pin
Chris Losinger17-Jun-10 9:28
professionalChris Losinger17-Jun-10 9:28 
GeneralRe: inheriting std::vector Pin
Stephen Hewitt17-Jun-10 14:05
Stephen Hewitt17-Jun-10 14:05 
GeneralRe: inheriting std::vector Pin
Chris Losinger17-Jun-10 16:34
professionalChris Losinger17-Jun-10 16:34 
GeneralRe: inheriting std::vector Pin
Emilio Garavaglia18-Jun-10 3:12
Emilio Garavaglia18-Jun-10 3:12 
GeneralRe: inheriting std::vector Pin
Chris Losinger18-Jun-10 11:17
professionalChris Losinger18-Jun-10 11:17 
Questionscan array of byte Pin
rockago17-Jun-10 8:25
rockago17-Jun-10 8:25 
AnswerRe: scan array of byte Pin
Niklas L17-Jun-10 8:34
Niklas L17-Jun-10 8:34 
GeneralRe: scan array of byte Pin
rockago17-Jun-10 8:48
rockago17-Jun-10 8:48 
GeneralRe: scan array of byte Pin
Niklas L17-Jun-10 9:11
Niklas L17-Jun-10 9:11 
QuestionRe: scan array of byte Pin
David Crow17-Jun-10 9:11
David Crow17-Jun-10 9:11 
QuestionEnumwindows hangs (freezing) application any idea? Pin
ERLN17-Jun-10 8:07
ERLN17-Jun-10 8:07 
QuestionRe: Enumwindows hangs (freezing) application any idea? Pin
David Crow17-Jun-10 9:07
David Crow17-Jun-10 9:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.