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

  • Home
  • SEARCH
  • 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 6252635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:50:25+00:00 2026-05-24T13:50:25+00:00

If I make some code like this: boost::array<10> a1; boost::array<20> a2; boost::array<30> a3; Will

  • 0

If I make some code like this:

boost::array<10> a1;
boost::array<20> a2;
boost::array<30> a3;

Will the template generate 3 different classes for me and make the size of my code grow?

If it does, is the compiler/linker smart enough to only include the methods definitions of what I’m actually using? For example: if I use the method ‘at’ of the a1 object, but never user the method ‘at’ of the a2 object, then the ‘at’ of the a2 would be totally discarded.

  • 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-05-24T13:50:27+00:00Added an answer on May 24, 2026 at 1:50 pm

    Will the template generate 3 different classes for me

    Yes; every instantiation of a template with different template arguments in in effect a different type.

    and make the size of my code grow?

    Extremely unlikely, certainly no worse than enabling inlining does.

    If it does, is the compiler/linker smart enough to only include the methods definitions of what I’m actually using?

    Yes, unless you explicitly instantiate the type as a whole.

    For example: if I use the method ‘at’ of the a1 object, but never user the method ‘at’ of the a2 object, then the ‘at’ of the a2 would be totally discarded.

    If you never use the method at of a2, and you didn’t explicitly instantiate boost::array<T, 20> as a whole, then boost::array<T, 20>::at() is never instantiated to begin with and there’s nothing to discard.

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

Sidebar

Related Questions

I have some code like this to find all instances of the template in
I have some original code that manages exception safety like this: void foo() {
I'm relatively new to WPF. I'm examining some code that looks like this: private
How do I make code like this thread safe? public static class Converter {
I have some code like this: var effects = xElement.Elements ( Effects ).Elements (
I wanted to write some code like this: class SomeModel(models.Model): field = models.ForeignKey(SomeOtherModel) def
If I have some lua code like this: doSomething(function() print(Hello!) end) How can I
I have a code like this,In this context HandleDisconnectEventCB will trigger when client has
I've got some code like this: @interface MyTimer : NSObject - (int)getValue; @end @interface
I need to make some code to talk to a SOAP web service. Unfortunately

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.