J'ai un problème en compilation apparemment il ne veut pas créer des integer sequences vide :
/home/laurent/gitODFAEG/ODFAEG/src/odfaeg/Graphics/3D/../../../../include/odfaeg/Graphics/3D/../../Math/../Math/../Core/resourceManager.h:378:62: error: no matching function for call to ‘createResourceP(std::tuple<>&, std::make_index_sequence<0>)’
378 | std::unique_ptr<R> resource = createResourceP(tuple, std::make_index_sequence<std::tuple_size_v<T>>());
template <typename T, typename R, typename... Ints>
std::unique_ptr<R> createResourceP (T tuple, std::integer_sequence<Ints...> inds) {
std::unique_ptr<R> resourcePtr = std::make_unique(std::get<Ints>(tuple)...);
return std::move(resourcePtr);
}
template <typename R, typename I>
template <typename T, typename... A>
void ResourceManager<R, I>::fromFile(const std::string& path, T tuple, A... args)
{
std::lock_guard<std::recursive_mutex> locker(rec_mutex);
if (!exists(path)) {
std::unique_ptr<R> resource = createResourceP(tuple, std::make_index_sequence<std::tuple_size_v<T>>());
if (!resource->loadFromFile(path, args...)) {
throw Erreur(6, "ResourceManager::load - Failed to load "+path,0);
}
insertResource(path, std::move(resource));
}
}
template <typename R, typename I>
template <typename T, typename... A>
void ResourceManager<R, I>::fromFileWithAlias(const std::string& path, const I& alias, T tuple, A... args)
{
std::lock_guard<std::recursive_mutex> locker(rec_mutex);
// Create and load resource
if (!exists(path)) {
std::unique_ptr<R> resource = createResourceP(tuple, std::make_index_sequence<std::tuple_size_v<T>>());
typename std::map<I, unsigned int>::iterator it = mAliasMap.find(alias);
if (it == mAliasMap.end()) {
if (!resource->loadFromFile(path, args...)) {
throw Erreur(6, "ResourceManager::load - Failed to load "+path,0);
}
// If loading successful, insert resource to map
insertResource(path, std::move(resource), alias);
} else {
throw Erreur(5, "Alias already used!", 0);
}
}
unsigned int id = getIdByPath(path);
mAliasMap.insert(std::make_pair(alias, id));
}
template <typename T, typename R, std::size_t... Ints>
std::unique_ptr<R> createResourceP (T tuple, std::index_sequence<Ints...> inds) {
std::unique_ptr<R> resourcePtr = std::make_unique(std::get<Ints>(tuple)...);
return std::move(resourcePtr);
}
template <typename R, typename I>
template <typename T, typename... A>
void ResourceManager<R, I>::fromFile(const std::string& path, T tuple, A... args)
{
std::lock_guard<std::recursive_mutex> locker(rec_mutex);
if (!exists(path)) {
std::unique_ptr<R> resource = createResourceP(tuple, std::make_index_sequence<std::tuple_size_v<T>>());
if (!resource->loadFromFile(path, args...)) {
throw Erreur(6, "ResourceManager::load - Failed to load "+path,0);
}
insertResource(path, std::move(resource));
}
}
template <typename R, typename I>
template <typename T, typename... A>
void ResourceManager<R, I>::fromFileWithAlias(const std::string& path, const I& alias, T tuple, A... args)
{
std::lock_guard<std::recursive_mutex> locker(rec_mutex);
// Create and load resource
if (!exists(path)) {
std::unique_ptr<R> resource = createResourceP(tuple, std::make_index_sequence<std::tuple_size_v<T>>());
typename std::map<I, unsigned int>::iterator it = mAliasMap.find(alias);
if (it == mAliasMap.end()) {
if (!resource->loadFromFile(path, args...)) {
throw Erreur(6, "ResourceManager::load - Failed to load "+path,0);
}
// If loading successful, insert resource to map
insertResource(path, std::move(resource), alias);
} else {
throw Erreur(5, "Alias already used!", 0);
}
}
unsigned int id = getIdByPath(path);
mAliasMap.insert(std::make_pair(alias, id));
}
- Edité par OmbreNoire 21 novembre 2023 à 20:55:31
Erreur en compilation
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.