STL + typedefs vs OOP, best practices?

I grew up learning how to customize data structures using OOP. But now that I’m learning more about C ++, STL, and Boost, I’ve found that many of my data structure needs can be met by combining STL classes into more complex composites, such as:

typedef std::map<std::string, std::map<std::string, int> > CSVData;

Obviously, there are limitations to this when I need to mix data types, but I usually avoid OOP when I can, in favor of these STL composites, for their simplicity. Is this a common progression? Are there best practice rules when it's best to define your own class? Are there any common problems?

+5
source share
6 answers

: , typedefs, ?

. ( , , , - ), : . 1001-1255.

.. : , , - . typedef : CSV .

typedef: , , ( , ...). , , typedefd.

, , , .

: .

, ( ): typedef - . : CSV- . , . .

, ++ , : , ( IO) -: . , .

+7

, OO , . , , .

+4

, , :

  • . ( , .)
  • , . ( , .. typedefs.)
0

typedef ( , /).

( ) , : , / :

  • , ,
  • : , /

, typedef , . .

0

, Effective ++ (Third Edition) , ++ . - . (STL-) - . .

, , . , , . , , , .

, - , . OO, .

0

, .

@adrian-mccarthy, ++ - , .

- .

- .

typedef , templatize , . ( , .)

templatize, , ( ). , .

0
source

All Articles