Функции шаблона С++ конфликтуют и выдают неоднозначную ошибкуC++

Программы на C++. Форум разработчиков
Anonymous
Функции шаблона С++ конфликтуют и выдают неоднозначную ошибку

Сообщение Anonymous »

Код: Выделить всё

#include 
#include 
#include 
#include 

// Define dummy attribute types
namespace Attr {
struct Int {};
struct Float {};
struct String {};

// TypeMap must be defined before being used
template  struct TypeMap; // Primary template

// Specializations
template  struct TypeMap { using type = int; };
template  struct TypeMap { using type = float; };
template  struct TypeMap { using type = std::string; };
}

// Define AttrTypes
template 
struct AttrTypes {};

template 
std::vector allowed_types() {
return { std::type_index(typeid(typename Attr::TypeMap::type))... };
}

// Single type version
template >
void addInput(Args&&... args) {
// Leave it as is. It's here to test if both addInput are working.
//std::vector allowedTypes = {std::type_index(typeid(typename Attr::TypeMap::type))};
std::cout 

Подробнее здесь: [url]https://stackoverflow.com/questions/79643985/c-template-functions-conflicts-and-throws-ambiguous-error[/url]

Вернуться в «C++»