Questions tagged [boost-parameter]

Boost Parameter Library allows to write functions and class templates that can accept arguments by name

In C++, arguments are normally given meaning by their positions with respect to a parameter list: the first argument passed maps onto the first parameter in a function's definition and so on. That protocol is fine when there is at most one parameter with a default value, but when there are even a few useful defaults, the positional interface becomes burdensome.

The library addresses the problem outlined by associating each parameter name with a keyword object.

13 questions
35
votes
6 answers

C++ "Named Parameter Idiom" vs. Boost::Parameter library

I've looked at both the Named Parameter Idiom and the Boost::Parameter library. What advantages does each one have over the other? Is there a good reason to always choose one over the other, or might each of them be better than the other in some…
Head Geek
  • 38,128
  • 22
  • 77
  • 87
16
votes
2 answers

Using strong typedef as a more lightweight alternative to Boost Parameter library?

I often use the Boost strong typedef utility to improve the safety of my programs. For example by writing code like this: BOOST_STRONG_TYPEDEF(int, X) BOOST_STRONG_TYPEDEF(int, Y) BOOST_STRONG_TYPEDEF(int, Width) BOOST_STRONG_TYPEDEF(int,…
StackedCrooked
  • 34,653
  • 44
  • 154
  • 278
12
votes
1 answer

How can I get faster compilation speed with a boost.parameter like syntax?

I am currently using boost.parameter with some factory functions and compile times are getting prohibitive. currently I have a common pattern like this: auto thing = makeThing(property1 = foo::bar, "myThing"_thingName); where makeThing has like 30…
odinthenerd
  • 5,422
  • 1
  • 32
  • 61
4
votes
1 answer

Using Boost Parameter with operator()

I would like to use Boost Parameter together with an overloaded call operator (operator()): #include #include #include struct add_argument_tag { struct name_; struct…
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
4
votes
2 answers

Why do Boost Parameter elected inheritance rather than composition?

I suppose most of the persons on this site will agree that implementation can be outsourced in two ways: private inheritance composition Inheritance is most often abused. Notably, public inheritance is often used when another form or inheritance…
Matthieu M.
  • 287,565
  • 48
  • 449
  • 722
4
votes
2 answers

Boost Parameters library

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 { …
nogard
  • 9,432
  • 6
  • 33
  • 53
1
vote
1 answer

How to use boost::ref with Boost.Parameter library when passing arguments?

I use the Boost.Parameter library for providing named parameters to a constructor. BOOST_PARAMETER_NAME(windowFunction) namespace detail { struct ClassAImpl { template ClassAImpl(ArgumentPack const& args) :…
Hannah S.
  • 3,081
  • 3
  • 20
  • 27
1
vote
0 answers

Use initialization list with boost-parameter

The following code will not compile because in the last call to 'demo' the compiler cannot deduce a type from the initialization-list. #include #include #include #include…
Markus Lenger
  • 521
  • 5
  • 7
1
vote
0 answers

Problems using predicate checking with the Boost Parameter library

I am fairly new to using Boost (the Boost Graph Library actually), and am trying to write my first graph algorithm. Since my algorithm will require several optional and defaultable parameters to be passed in to it, I thought I would try to use the…
ianr
  • 11
  • 1
1
vote
1 answer

Boost.Parameter: named template argument in combination with CRTP

Warning: longish introduction ahead needed to explain the problem. The Named Template Argument idiom first described in ch 16.1 of Vandevoorde and Josuttis can be conveniently written with the Boost.Parameter library #include
TemplateRex
  • 69,038
  • 19
  • 164
  • 304
1
vote
1 answer

Specifying alternate defaults for boost signals2

Boost's signals2 library defines a nice way to pass through alternate parameters for some of its extended functionality (via its Parameters library). When one of these alternate parameters is fairly commonplace in my code then I want to make a…
Miral
  • 12,637
  • 4
  • 53
  • 93
0
votes
1 answer

boost::property_tree : Parsing of Complex xml strucure

I am want to parse below xml structure using boost property_tree.
Sandip Patidar
  • 157
  • 1
  • 14
0
votes
1 answer

Using friends with base classes for Boost Parameter

I'm using the Boost Parameter tutorial to create a named-parameter constructor for a playing card generator. The tutorial says to put the ArgumentPack into a base class, but I want to modify variables in the card generator class. I've thought about…
mmoran
  • 1,001
  • 1
  • 8
  • 16