In Boost.DI documentation interesting notation exist that called named annotation and like below

auto Rows = []{};
auto Cols = []{};

class model {
   model(int size, double precision) { }
   BOOST_DI_INJECT(model, (named = Rows) int rows, (named = Cols) int cols); // this constructor will be injected

model::model(int rows, int cols) {}

for more information about this feature you can see named annotation feature in official documents.

My question is how to create something like this in C++?, I think it is useful to create custom annotation like named annotation in our library, but I don't know how to it?

0 Answers