| 376 | } |
| 377 | |
| 378 | void add_reserve_var(std::string_view reserve, bool is_mem_fn = false) |
| 379 | { |
| 380 | mIsMemFn = is_mem_fn; |
| 381 | if (!mIsVargs) { |
| 382 | std::vector<std::string> args{std::string(reserve)}; |
| 383 | args.reserve(mArgs.size()); |
| 384 | for (auto &name : mArgs) { |
| 385 | if (name != reserve) |
| 386 | args.emplace_back(std::move(name)); |
| 387 | else |
| 388 | throw runtime_error("Overwrite the default argument \"" + std::string(reserve) + "\"."); |
| 389 | } |
| 390 | std::swap(mArgs, args); |
| 391 | } |
| 392 | #ifdef CS_DEBUGGER |
| 393 | std::string prefix, suffix; |
| 394 | auto lpos = mDecl.find('(') + 1; |
| 395 | auto rpos = mDecl.rfind(')'); |
| 396 | prefix = mDecl.substr(0, lpos); |
| 397 | suffix = mDecl.substr(rpos); |
| 398 | if (mArgs.size() > 1 || mIsVargs) |
| 399 | mDecl = prefix + "this" + (mIsVargs ? ", ..." : ", ") + mDecl.substr(lpos, rpos - lpos) + suffix; |
| 400 | else |
| 401 | mDecl = prefix + "this" + suffix; |
| 402 | #endif |
| 403 | } |
| 404 | |
| 405 | std::size_t argument_count() const noexcept |
| 406 | { |
no test coverage detected