This commit is contained in:
Timur A. Fatkhullin
2025-08-28 00:43:55 +03:00
parent 45f655dc90
commit 2e5e1918e1
5 changed files with 271 additions and 143 deletions

View File

@@ -15,6 +15,7 @@ namespace mcc
enum class MccPZoneContainerErrorCode : int {
ERROR_OK,
ERROR_NULLPTR,
ERROR_INVALID_SIZE,
ERROR_INZONE_FUNC,
ERROR_TIMETO_FUNC,
ERROR_TIMEFROM_FUNC,
@@ -61,6 +62,8 @@ struct MccPZoneContainerCategory : public std::error_category {
return "OK";
case MccPZoneContainerErrorCode::ERROR_NULLPTR:
return "nullptr argument";
case MccPZoneContainerErrorCode::ERROR_INVALID_SIZE:
return "invalid range size of input argument";
case MccPZoneContainerErrorCode::ERROR_INZONE_FUNC:
return "inPZone method error";
case MccPZoneContainerErrorCode::ERROR_TIMETO_FUNC:
@@ -308,16 +311,20 @@ public:
return MccPZoneContainerErrorCode::ERROR_NULLPTR;
}
using CPT = std::ranges::range_value_t<R>;
if (traits::mcc_range_size(*result) < sizePZones()) {
return MccPZoneContainerErrorCode::ERROR_INVALID_SIZE;
}
// using CPT = std::ranges::range_value_t<R>;
MccCelestialPoint pt;
auto apply_func = [&](auto& func, auto& pt_arg, size_t i) {
error_t ret = func(pt_arg, &pt);
if (!ret) {
if (traits::mcc_range_size(*result) == i) {
std::back_inserter(*result) = CPT();
}
// if (traits::mcc_range_size(*result) == i) {
// std::back_inserter(*result) = CPT();
// }
auto ptr = result->begin();
std::ranges::advance(ptr, i);