{} usage in template specialization/call

I am trying to uderstand beter a teplate code:
request.setOpt (CO::Url {string {K.url_base} + "public/" + K.query_url});

Where I can read about this type of call (specialization)

SO... Template <> not used but template{}

What is this type of {} syntax?
How to interpret this code ? (obviously call of template function, but ... strange). How is this syntax called? Is there a term ?

The code is from the public CurlPP project

Any help is wellcome. Thanks in advance.
It has nothing to do with templates, it's the uniform initialization syntax. string {K.url_base} constructs a string object by passing K.url_base to the constructor.
Last edited on
More info (more connected code):
...
namespace curlpp
{
namespace options
{
...
typedef curlpp::OptionTrait<std::string, CURLOPT_URL> Url;
...
namespace DMBCS {
namespace C = curlpp;
namespace CO = C::Options;
...
template<typename OptionType, CURLoption option>
OptionTrait<OptionType, option>::OptionTrait(typename Option<OptionType>::ParamType value)
: Option<OptionType>(option, value)
{}
Last edited on
Thank you
Another look at uniform initialization, a feature added in C++11:

https://mbevin.wordpress.com/2012/11/16/uniform-initialization/
Topic archived. No new replies allowed.