c++-templates Questions

1

I've encountered a really weird problem with clang. When I compile my code with C++20 using gcc-11 everything is fine. The problem appears when I try to compile it with C++20 and clang-14 (using cl...
Gelhar asked 13/2, 2024 at 18:10

3

Solved

Whats wrong with this: #include <type_traits> struct A; template<typename T> struct B { template<typename=std::enable_if<std::is_copy_constructible<T>::value>> vo...
Kabob asked 10/10, 2019 at 10:5

2

Solved

I wrote the following template function, which checks whether an arbitary container contains a specific element: template<template<class, class...> class container_t, class item_t, class....
Translative asked 8/4, 2015 at 17:6

3

Solved

I need to define a C++ template that accepts several 3D coordinates as their parameters. Why do I need this? The motivation is to create an "accessor" template for doing implicit index tr...
Intemerate asked 17/12, 2023 at 5:41

2

Solved

I need to define a C++ template that accepts several 3D coordinates as their parameters. When all dimensions of these coordinates are defined as separate integer variables, the parameter list would...

2

Solved

I'd like to make a function with both sync and coroutine version, without using template specialization, i.e. with an if constexpr. This is the function I wrote: template <Async _a> AsyncResu...
Shag asked 11/3, 2022 at 2:55

1

Solved

Concepts can be used to put a constraint on types as template parameters like the example below: template<typename t, int v> concept the_concept1 = sizeof(t) > v; template<int v, the_c...

8

Solved

I am trying to create ArrayList<int> myList = new ArrayList<int>(); in Java but that does not work. Can someone explain why int as type parameter does not work? Using Integer class ...
Angieangil asked 15/6, 2009 at 13:32

4

Solved

I have a function somewhere called x that returns a know value and has known parameters: int x(int y); I have somewhere else, I want to create a container to contain n invocations of this functi...
Eudy asked 31/12, 2016 at 10:46
1

© 2022 - 2025 — McMap. All rights reserved.