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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:27:46+00:00 2026-06-09T20:27:46+00:00

Recently I found Parameters library in the Boost. Honestly I didn’t understand the reason

  • 0

Recently I found Parameters library in the Boost. Honestly I didn’t understand the reason why this is a part of Boost. When there is need to pass several parameters to the function you can make a structure from them, like:

struct Parameters
{
    Parameters() : strParam("DEFAULT"), intParam(0) {}
    string strParam;
    int intParam;
};

void foo(const Parameters & params)
{
}

Parameters params;
params.intParam = 42;
foo(params);

This is very easy to write and understand.
Now example with using Boost Parameters:

BOOST_PARAMETER_NAME(param1) 
BOOST_PARAMETER_NAME(param2)

BOOST_PARAMETER_FUNCTION(
  (void),                // 1. parenthesized return type
  someCompexFunction,    // 2. name of the function template

  tag,                   // 3. namespace of tag types


  (optional              //    optional parameters, with defaults
    (param1,           *, 42)
    (param2,           *, std::string("default"))              )
  )
{
    std::cout << param1 << param2;
}

someCompexFunction(param1_=42);

I think it’s really complex, and the benefit is not that significant..

But now I see that some of the Boost libraries (Asio) use this technique.
Is it considered a best practice to use this library to pass many arguments?

Or maybe there are real benefits of using this library that I don’t see?
Would you recommend using this library in the project?

  • 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-09T20:27:47+00:00Added an answer on June 9, 2026 at 8:27 pm

    Your technique requires creating a lot of temporaries (given enough
    parameters) and will be rather verbose in some cases. Something that
    is even more tricky is documentation. If you go down the route of
    configuration structs, you will have two places where you need to
    explain your parameters. Documenting Boost.Parameter functions is easy
    in comparison.

    It also keeps the verbosity down and allows me to reuse arguments for
    whole families of functions instead of composing a new configuration
    carrier over and over again.

    If you don’t like the library, don’t use it. It has several other
    drawbacks you haven’t mentioned (heavy includes, high compile times).

    Also, why not just provide the best of two worlds? One function using Boost.Parameters and another using configuration structs, where both dispatch on a common implementation. Manage headers correctly and the “don’t pay for what you don’t use” promise will be kept. The price is maintainability. But you can always deprecate one interface if your users don’t like it.

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

Sidebar

Related Questions

I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2
I recently found the boost ptr_vector useful to manage my collection of heap-allocated objects.
I recently found out that the types of parameters in a non-defining function declaration
The obvious answer is to use Charset.defaultCharset() but we recently found out that this
I recently found some code like this: typedef int TenInts[10]; void foo(TenInts &arr); What
I recently encountered this problem. I found many instances of people asking the question—
I recently made a notepad like program for C# and found a library for
I recently found this which is great as its the API but it doesn't
I recently found that this is impossible in SQLite: SELECT * FROM fruit WHERE
recently found an article in http://hashtwo.com/blog/integrating-a-file-browser-into-ckeditor-cakephp to integrate a file browser into ckeditor (file

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.