Boost logo

Boost Users :

Subject: [Boost-users] Flyweight: constexpr user defined literals
From: Akim Demaille (akim_at_[hidden])
Date: 2014-11-07 09:40:40


Hi all, Hi Joaquin,

I'm using flyweights of strings (aka symbols) for my "format" arguments: a
key that specifies the kind of output that should be produced
by the printing routines.

Sometimes, I have code that roughly resembles to:

  print_entry_(src, dst, o, dot2tex_ ? symbol("latex") : symbol("text"));

My question is: do we have constexpr constructors with Flyweight
in such a way that I could have something like:

  print_entry_(src, dst, o, dot2tex_ ? "latex"sym : "text"sym);

and have a single construction of these guys not matter how many
times I go throw this piece of code, or should I build them once for
all in say a member?

  print_entry_(src, dst, o, dot2tex_ ? sym_latex : sym_text);

I've seen nothing about "constexpr" in the doc.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net