masaori335 commented on a change in pull request #6692:
URL: https://github.com/apache/trafficserver/pull/6692#discussion_r412563078
##########
File path: src/traffic_cache_tool/CacheTool.cc
##########
@@ -255,6 +255,8 @@ class VolumeAllocator
: _config(config), _size(size), _deficit(deficit), _shares(shares)
{
}
+ V(const V &v) : _config(v._config), _size(v._size), _deficit(v._deficit),
_shares(v._shares) {}
Review comment:
Using `= default` and generate copy constructor looks better. Will do.
@SolidWallOfCode will describe better, but if I use the default copy
assignment, I got below error.
```
/usr/local/opt/llvm/include/c++/v1/algorithm:3945:17: error: no matching
function for call to 'swap'
swap(*__first, *__last);
^~~~
/usr/local/opt/llvm/include/c++/v1/algorithm:4125:12: note: in instantiation
of function template specialization 'std::__1::__sort<(lambda at
traffic_cache_tool/CacheTool.cc:407:37) &, ct::VolumeAllocator::V *>' requested
here
_VSTD::__sort<_Comp_ref>(__first, __last, _Comp_ref(__comp));
^
/usr/local/opt/llvm/include/c++/v1/algorithm:4158:12: note: in instantiation
of function template specialization 'std::__1::sort<ct::VolumeAllocator::V *,
(lambda at traffic_cache_tool/CacheTool.cc:407:37) &>' requested here
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
^
traffic_cache_tool/CacheTool.cc:407:8: note: in instantiation of function
template specialization 'std::__1::sort<ct::VolumeAllocator::V, (lambda at
traffic_cache_tool/CacheTool.cc:407:37)>' requested here
std::sort(_av.begin(), _av.end(), [](V const &lhs, V const &rhs) { return
lhs._deficit > rhs._deficit; });
^
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]