Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8867301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:59:41+00:00 2026-06-14T16:59:41+00:00

I come from a Python background, but I was reading up on the kind

  • 0

I come from a Python background, but I was reading up on the kind of objects and data structures available in the C++ standard library and I see that the declaration for say, a vector of strings:

vector<string> names(10);

Would indicate a vector object initialized to hold 10 objects of type string. My questions are:

  • Does the <string> part of the declaration have an abstraction to C++ class system, i.e. is it a in built syntax for the vector object or part of some feature of the class system that can be used on user-defined class definitions?
  • Am I right in assuming that the brackets followed by the name are the arguments passed to the constructor function?
  • Is string a built-in type like int or an object defined by the standard library. And thus, is there a difference between built-in types and other objects (for instance all “types” are objects in Python)?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:59:42+00:00Added an answer on June 14, 2026 at 4:59 pm

    There are two sorts of parameters to std::vector objects:

    1. There template arguments which are for std::vector the value type and the allocator types with the latter being defaulted. That is, std::vector<std::string> actually happens to be std::vector<std::string, std::allocator<std::string> >.
    2. There are run-time parameters passed as constructor arguments and std::vector<...> takes quite a few combinations of those. In the above quoted use the 10 is the number of initial elements given to the vector.

    So, to answer your concrete questions:

    1. The string happens to be std::string and is nothing special at all. You can use any user-defined type which models certain concepts (e.g. the type needs to be CopyConstructible).
    2. The arguments in the parentheses are the contructor arguments (in the C++ context brackets are normally [ and ] but the term is ambiguous).
    3. string, well, actually std::string is not defined as a built-in type but it is a type from the standard C++ library. How the standard C++ library types are implemented is pretty much up to the C++ implementation, however, i.e., an implementation could choose to make it built-in (as long as it can still be used like a class type).

    In C++ there are a few differences between built-in types and class types but with C++ 2011 it is gets pretty close to being able to create class types which behave like built-in types. The primary difference is that it is possible to take the address of certain members of class types while the same “members” are not accessible for built-in types. Another difference is that built-in types don’t need to be declared (actually, they cannot be declared) while class types need to be declared and/or defined (depending on how these are used).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I come from a python background, where it's often said that it's easier to
I come from the ruby and python worlds where we have many libraries that
I come from a background of C, Fortran, Python, R, Matlab, and some Lisp
I'm new to Python and come from a Java background. I'd like to know
I am following a book to learn C++ (come from a python background). I've
I come from a java background, but I'm working on a django-based website. To
I come from a PHP and Python/GAE background and am new to RoR. Typically
When committing data that has originally come from a webpage, sometimes data has to
First off, I come from a RDBMS/SQL/C++/Java/Python background and I'm a newbie to Gaelyk,
I'm a complete n00b to django & python. I come from a PHP background

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.