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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:22:07+00:00 2026-06-03T00:22:07+00:00

i am using a boost::array which has the format < char, const std::size_t >

  • 0

i am using a boost::array which has the format
< char, const std::size_t >

void test(const std::size_t XXX)
{
    boost::shared_ptr<boost::array<unsigned char, XXX>> buf(new boost::array<unsigned char, max_size>);
    .
    .
    .
};
test(100);
test(20);

This is leading

to the Error:

error C2971: ‘boost::array’ : template parameter ‘N’ : ‘size’ : a local variable cannot be used as a non-type argument

Can you give me a hint how to pass boost::array the second parameter?

thanks

  • 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-03T00:22:09+00:00Added an answer on June 3, 2026 at 12:22 am

    Templates are instantiated during the compilation, so that their parameters have to be known before the program runs.

    That means you cannot use a variable as a template parameter. Such a parameters must be constant expressions (constant variables is not enough), addresses of functions or objects with external linkage, or addresses of static class members.

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

Sidebar

Related Questions

I'm using boost::asio, and I have code like this: void CServer::Start(int port) { tcp::acceptor
i have a a char array in C++ which looke like {'a','b','c',0,0,0,0} now im
I'm looking for a C++ container that's a cross between boost::array, boost::scoped_array and std::vector.
Possible Duplicates: Implementing a matrix, which is more efficient - using an Array of
i have noticed that #include <iostream> #include <boost/array.hpp> #include <boost/asio.hpp> using boost::asio::ip::tcp; int main(int
asio::ip::address_v6 takes a bytes_type for a parameter, which is basically a boost::array in network-byte
I'm using a boost array as buffer for the content I get from the
I have a shared_array: boost::shared_array myarr(new char[m_length]); I would like to reallocate the array.
I'm writing a TCP client using boost::asio . I want to send an array
I'm using boost::any in combination with boost::any_cast<> to write some framework code which should

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.