pmt: Add new type (class) to libhelper, etc.
- Add Helper::Capsule. - Fix some compilation errors.
This commit is contained in:
@@ -89,8 +89,8 @@ public:
|
||||
Info operator[](int index) const;
|
||||
BasicInf operator[](const std::string_view &name) const;
|
||||
|
||||
operator std::vector<Info>() const;
|
||||
operator int() const;
|
||||
explicit operator std::vector<Info>() const;
|
||||
explicit operator int() const;
|
||||
|
||||
class iterator {
|
||||
public:
|
||||
@@ -166,7 +166,6 @@ public:
|
||||
|
||||
/**
|
||||
* Returns the current list content in Map_t type.
|
||||
* If no list is created, returns std::nullopt.
|
||||
*/
|
||||
[[nodiscard]] Map_t getAll() const;
|
||||
|
||||
@@ -368,17 +367,17 @@ public:
|
||||
/**
|
||||
* Get map contents as vector (PartitionManager::Info type).
|
||||
*/
|
||||
[[nodiscard]] operator std::vector<Info>() const;
|
||||
[[nodiscard]] explicit operator std::vector<Info>() const;
|
||||
|
||||
/**
|
||||
* Get total partition count in map (int type).
|
||||
*/
|
||||
[[nodiscard]] operator int() const;
|
||||
[[nodiscard]] explicit operator int() const;
|
||||
|
||||
/**
|
||||
* Get current working directory.
|
||||
*/
|
||||
[[nodiscard]] operator std::string() const;
|
||||
[[nodiscard]] explicit operator std::string() const;
|
||||
};
|
||||
|
||||
using Error = Helper::Error;
|
||||
|
||||
@@ -425,10 +425,12 @@ basic_partition_map_builder::operator[](const std::string_view &name) const {
|
||||
}
|
||||
|
||||
basic_partition_map_builder::operator std::vector<Info>() const {
|
||||
return _current_map;
|
||||
return static_cast<std::vector<Info>>(_current_map);
|
||||
}
|
||||
|
||||
basic_partition_map_builder::operator int() const { return _current_map; }
|
||||
basic_partition_map_builder::operator int() const {
|
||||
return static_cast<int>(_current_map);
|
||||
}
|
||||
|
||||
basic_partition_map_builder::operator std::string() const { return _workdir; }
|
||||
|
||||
|
||||
@@ -55,9 +55,11 @@ int main() {
|
||||
for (const auto &name : *physicals)
|
||||
std::cout << " - " << name << std::endl;
|
||||
|
||||
if (const std::vector<PartitionMap::Info> parts = MyMap; parts.empty())
|
||||
if (const std::vector<PartitionMap::Info> parts =
|
||||
static_cast<std::vector<PartitionMap::Info>>(MyMap);
|
||||
parts.empty())
|
||||
throw PartitionMap::Error(
|
||||
"operator std::vector>PartitionMap::Info>() returned empty vector");
|
||||
"operator std::vector<PartitionMap::Info>() returned empty vector");
|
||||
|
||||
auto func = [](const std::string &partition,
|
||||
const PartitionMap::BasicInf props) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user