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 7801567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:59:22+00:00 2026-06-02T00:59:22+00:00

I am including several STL headers such as list and vector in all my

  • 0

I am including several STL headers such as list and vector in all my code files for my project. I know for my own headers that I should use include guards, but what about for this scenario when they aren’t defined by me?

Is it bad to include the same headers in every one of my files? Is there a performance penalty for each time it is included?

  • 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-02T00:59:24+00:00Added an answer on June 2, 2026 at 12:59 am

    There is no performance cost. The standard headers have their own include guards, and all include guards are optimized by the preprocessor so the file isn’t actually reloaded each time.

    Correctness and maintainability are always the first concern… how much compile time do you have to save to make up for work spent fixing things when you rearrange the files and get “undefined identifier” errors, or worse!

    EDIT: There is no performance cost to multiply including the same standard headers from all your header files. There is some performance cost to including additional standard headers from a source file. The question is a bit ambiguous… but either way, the really expensive part of C++ compilation is usually template instantiation, not parsing the text.

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

Sidebar

Related Questions

I've seen several suggestions on naming files randomly, including using System.IO.Path.GetRandomFileName() or using a
Background I am writing a program that targets several different phones, including the iPhone.
My c# WinForm solution contains several projects including an Admin project with several forms
We have a project with several applications including web applications, web services, windows services
I am writing an SSRS report that has several parameters including a couple of
If I use curl to access a page that contains several resources including videos,
I'm currently building a Flex 4.5 mobile project including several views and custom written
I have a mysql database with a table that has several fields including: enter_date
It seems like Sql Reporting Services Server logs information in several places including web
I have table A and table B with Table A having several columns including

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.