-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy a fmt::dynamic_format_arg_store<Context> object #2431
Comments
It could be implemented but if you want to capture arguments you could use a
No |
I don't know beforehand the types of variables that I will I need to copy, not move, so being moveable is something I can't utilize. As far as the copy- constructor, I quickly implemented something like below inside /**
\rst
Default constructor
\endrst
*/
constexpr FMT_INLINE dynamic_format_arg_store() = default;
/**
\rst
Constructs a `dynamic_format_arg_store` object from
dynamic_format_arg_store`.
\endrst
*/
constexpr FMT_INLINE dynamic_format_arg_store(
const dynamic_format_arg_store<Context>& store)
{
this->data_ = store.data_;
this->named_info_ = store.named_info_;
} Most probably that's not the best/correct way to do it, but it servers my purpose. Do you think that something like that could be added? It would be highly appreciated. Thanks in advance! |
Yeah,
Maybe but why is move not sufficient? |
Maybe I am not understanding the move concept correctly. Could you give me an example of how |
I don't know about your use case which is why I'm wondering why you need two identical copies. Another option is to pass a reference or a |
I am trying to to something like below: fmt::dynamic_format_arg_store<fmt::format_context> dArgs;
std::vector<int> v1 = {5, 1235, 1235123};
dArgs.push_back(fmt::arg("global_username", std::ref("utkarsh1")));
dArgs.push_back(fmt::arg("global_hostname", std::ref("miron")));
dArgs.push_back(fmt::arg("global_vector", v1));
fmt::dynamic_format_arg_store<fmt::format_context> dArgs2(dArgs);
dArgs2.push_back(fmt::arg("extra", std::ref("extra-value"))); I want In simple terms, I want to use |
Makes sense. In that case my suggestions won't work and a PR to add a copy ctor would be welcome. |
I have a
fmt::dynamic_format_arg_store<fmt::format_context> args
object which i populate with some variables.I would like to be able to copy
args
into a new objectargs2
so that I can push back new variables while :args
inargs2
args
Is that possible in any way?
fmt::dynamic_format_arg_store
. Could one be implemented?fmt::dynamic_format_arg_store
object?The text was updated successfully, but these errors were encountered: