Я недавно обновился до gcc 6.3 с gcc 5.4. Код C ++, который раньше просто компилировался и запускался, прекратил компиляцию, и я не достаточно опытен, чтобы понять, что происходит не так.
Код находится в объекте, который я создал для порождения окон с помощью sfml. Он создает поток, который использует указатель sfml :: Window для обновления изображения на основе установленного извне указателя на видеокадр.
Код является основным и простым, и я порождаю потоки в другом месте кода (хотя не потоки объекта).
Вот фрагменты кода:
class owindow
{
public:
...
private:
...
std::thread renderThread;
...
void windowRender(void);
...
};
owindow::owindow(std::string name, win_t type, int width, int height, uint32_t *image)
: renderThread()
{
typ = type;
wid = width;
hei = height;
nam = name;
frame = image;
resizewin = false;
killthread = false;
...
window = new sf::Window(sf::VideoMode(windowwidth, windowheight), name.c_str(), sf::Style::Default, settings);
window->setVerticalSyncEnabled(false);
...
void owindow::start(void)
{
// Start the render thread.
renderThread = std::thread(&owindow::windowRender, this);
}
Ошибки генерируются в строке renderThread =, показанной выше (строка 174, в выводе ошибок), длинные и жестокие, и, честно говоря, я чувствую, что тону, когда пытаюсь их понять. С каких это пор у c ++ есть кортежи? ЛОЛ. Я изучаю Python на работе и, наконец, получил, что такое кортеж, а потом у меня это случилось …
Я только что проверил, он все еще компилируется и работает с gcc 5.4.
Вот ошибки, обратите внимание, что это только первые несколько ошибок, я не хотел спамить на форуме.
Обновлено:
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple: In instantiation of 'static constexpr bool std::_TC<<anonymous>, _Elements>::_MoveConstructibleTuple() [with _UElements = {const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]':
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:626:248: required by substitution of 'template<class ... _UElements, typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> > constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&}; typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> = <missing>]'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/functional:1363:8: required from 'struct std::_Bind_simple<void (*(int, camera*, int*, int*))(int, camera*, int*, int*)>'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/thread:136:55: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (*)(int, camera*, int*, int*); _Args = {int&, camera*, int*&, int*&}]'
/...snip.../ofunctions.hpp:3221:97: required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:483:67: error: mismatched argument pack lengths while expanding 'std::is_constructible<_Elements, _UElements&&>'
return __and_<is_constructible<_Elements, _UElements&&>...>::value;
^~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:484:1: error: body of constexpr function 'static constexpr bool std::_TC<<anonymous>, _Elements>::_MoveConstructibleTuple() [with _UElements = {const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]' not a return-statement
}
^
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple: In instantiation of 'static constexpr bool std::_TC<<anonymous>, _Elements>::_ImplicitlyMoveConvertibleTuple() [with _UElements = {const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]':
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:626:362: required by substitution of 'template<class ... _UElements, typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> > constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&}; typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> = <missing>]'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/functional:1363:8: required from 'struct std::_Bind_simple<void (*(int, camera*, int*, int*))(int, camera*, int*, int*)>'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/thread:136:55: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (*)(int, camera*, int*, int*); _Args = {int&, camera*, int*&, int*&}]'
/...snip.../ofunctions.hpp:3221:97: required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:489:65: error: mismatched argument pack lengths while expanding 'std::is_convertible<_UElements&&, _Elements>'
return __and_<is_convertible<_UElements&&, _Elements>...>::value;
^~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:490:1: error: body of constexpr function 'static constexpr bool std::_TC<<anonymous>, _Elements>::_ImplicitlyMoveConvertibleTuple() [with _UElements = {const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]' not a return-statement
}
^
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple: In instantiation of 'static constexpr bool std::_TC<<anonymous>, _Elements>::_NonNestedTuple() [with _SrcTuple = const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]':
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:662:419: required by substitution of 'template<class ... _UElements, class _Dummy, typename std::enable_if<((std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ConstructibleTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (1ul == 1)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NonNestedTuple<const tuple<_Elements ...>&>()), bool>::type <anonymous> > constexpr std::tuple< <template-parameter-1-1> >::tuple(const std::tuple<_Args1 ...>&) [with _UElements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}; _Dummy = void; typename std::enable_if<((std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ConstructibleTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (1ul == 1)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NonNestedTuple<const tuple<_Elements ...>&>()), bool>::type <anonymous> = <missing>]'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/functional:1363:8: required from 'struct std::_Bind_simple<void (*(int, camera*, int*, int*))(int, camera*, int*, int*)>'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/thread:136:55: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (*)(int, camera*, int*, int*); _Args = {int&, camera*, int*&, int*&}]'
/...snip.../ofunctions.hpp:3221:97: required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:495:244: error: wrong number of template arguments (6, should be 2)
return __and_<__not_<is_same<tuple<_Elements...>,
^
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/type_traits:1558:8: note: provided for 'template<class _From, class _To> struct std::is_convertible'
struct is_convertible
^~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:502:1: error: body of constexpr function 'static constexpr bool std::_TC<<anonymous>, _Elements>::_NonNestedTuple() [with _SrcTuple = const std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]' not a return-statement
}
^
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple: In instantiation of 'static constexpr bool std::_TC<<anonymous>, _Elements>::_MoveConstructibleTuple() [with _UElements = {std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]':
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:626:248: required by substitution of 'template<class ... _UElements, typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> > constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>}; typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> = <missing>]'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/functional:1363:8: required from 'struct std::_Bind_simple<void (*(int, camera*, int*, int*))(int, camera*, int*, int*)>'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/thread:136:55: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (*)(int, camera*, int*, int*); _Args = {int&, camera*, int*&, int*&}]'
/...snip.../ofunctions.hpp:3221:97: required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:483:67: error: mismatched argument pack lengths while expanding 'std::is_constructible<_Elements, _UElements&&>'
return __and_<is_constructible<_Elements, _UElements&&>...>::value;
^~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:484:1: error: body of constexpr function 'static constexpr bool std::_TC<<anonymous>, _Elements>::_MoveConstructibleTuple() [with _UElements = {std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]' not a return-statement
}
^
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple: In instantiation of 'static constexpr bool std::_TC<<anonymous>, _Elements>::_ImplicitlyMoveConvertibleTuple() [with _UElements = {std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]':
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:626:362: required by substitution of 'template<class ... _UElements, typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> > constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>}; typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (5ul >= 1)), bool>::type <anonymous> = <missing>]'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/functional:1363:8: required from 'struct std::_Bind_simple<void (*(int, camera*, int*, int*))(int, camera*, int*, int*)>'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/thread:136:55: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (*)(int, camera*, int*, int*); _Args = {int&, camera*, int*&, int*&}]'
/...snip.../ofunctions.hpp:3221:97: required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:489:65: error: mismatched argument pack lengths while expanding 'std::is_convertible<_UElements&&, _Elements>'
return __and_<is_convertible<_UElements&&, _Elements>...>::value;
^~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:490:1: error: body of constexpr function 'static constexpr bool std::_TC<<anonymous>, _Elements>::_ImplicitlyMoveConvertibleTuple() [with _UElements = {std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>}; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]' not a return-statement
}
^
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple: In instantiation of 'static constexpr bool std::_TC<<anonymous>, _Elements>::_NonNestedTuple() [with _SrcTuple = std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&&; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]':
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:686:422: required by substitution of 'template<class ... _UElements, class _Dummy, typename std::enable_if<((std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (1ul == 1)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NonNestedTuple<tuple<_Elements ...>&&>()), bool>::type <anonymous> > constexpr std::tuple< <template-parameter-1-1> >::tuple(std::tuple<_Args1 ...>&&) [with _UElements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}; _Dummy = void; typename std::enable_if<((std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_MoveConstructibleTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && std::_TC<(std::is_same<_Dummy, void>::value && (1ul == 1)), void (*)(int, camera*, int*, int*), int, camera*, int*, int*>::_NonNestedTuple<tuple<_Elements ...>&&>()), bool>::type <anonymous> = <missing>]'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/functional:1363:8: required from 'struct std::_Bind_simple<void (*(int, camera*, int*, int*))(int, camera*, int*, int*)>'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/thread:136:55: required from 'std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (*)(int, camera*, int*, int*); _Args = {int&, camera*, int*&, int*&}]'
/...snip.../ofunctions.hpp:3221:97: required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:495:244: error: wrong number of template arguments (6, should be 2)
return __and_<__not_<is_same<tuple<_Elements...>,
^
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/type_traits:1558:8: note: provided for 'template<class _From, class _To> struct std::is_convertible'
struct is_convertible
^~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/tuple:502:1: error: body of constexpr function 'static constexpr bool std::_TC<<anonymous>, _Elements>::_NonNestedTuple() [with _SrcTuple = std::tuple<void (*)(int, camera*, int*, int*), int, camera*, int*, int*>&&; bool <anonymous> = true; _Elements = {void (*)(int, camera*, int*, int*), int, camera*, int*, int*}]' not a return-statement
}
^
CMake Error at ocapture_generated_ocapture.cu.o.cmake:282 (message):
Error generating file
/...snip.../build/CMakeFiles/ocapture.dir//./ocapture_generated_ocapture.cu.omake[2]: *** [CMakeFiles/ocapture.dir/build.make:510: CMakeFiles/ocapture.dir/ocapture_generated_ocapture.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:67: CMakeFiles/ocapture.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
У меня была точно такая же проблема в течение нескольких дней, и когда я прочитал ваши выводы по «темам», мне удалось создать тестовый проект, который не работает в GCC 6.1.0, но работает на 5.3.0.
Важно отметить, что это не удается при компиляции под CUDA, то есть Launcher — это файл .cu. Если вы скомпилируете его как файл .cpp, проблема будет устранена путем установки флага -pthread в процессе компиляции.
Я сейчас работаю с 5.3.0 из-за этого. Я прилагаю здесь код, который не удается. Программное обеспечение, используемое, чтобы это терпело неудачу:
CMake 10, ниндзя, GCC 6.3.0, CUDA 9.0.176
Ракета-носитель:
#include "ClassWithT/Functions.hpp"#include <stdlib.h>
#include <iostream>
int main()
{
int* m = (int*)malloc(2 * sizeof(int));
float* n = (float*)malloc(2 * sizeof(float));
m[0] = 5;
m[1] = 6;
n[0] = 2.5f;
n[1] = 5.6f;
Functions<int>* f = new Functions<int>(m, 2, 0);
std::cout << f->ManagingFutures() << std::endl;
Functions<float>* g = new Functions<float>(n, 2, 0);
std::cout << g->ManagingFutures() << std::endl;
return 0;
}
Functions.ipp:
#pragma once
#include "Functions.hpp"
template<class T>
Functions<T>::Functions(T* list, int numValues, bool type)
{
valuesList = list;
numberOfValuesInList = numValues;
typeOfOperation = type;
}
template<class T>
T Functions<T>::DoSomeStuff()
{
T intAmount;
if (typeOfOperation == 0)
{
intAmount = valuesList[0] + valuesList[1];
}
else
{
intAmount = valuesList[0] - valuesList[1];
}
return intAmount;
}
template<class T>
T Functions<T>::ManagingFutures()
{
std::future<T> testThread;
testThread = std::async(std::launch::async, &Functions::DoSomeStuff, this);
return testThread.get();
}
Functions.hpp:
#pragma once
#ifndef FUNCTIONS_HPP
#define FUNCTIONS_HPP
#include <future>
template<class T>
class Functions
{
public:
Functions(T* intList, int numIntegers, bool type);
T DoSomeStuff();
T ManagingFutures();
private:
T* valuesList;
int numberOfValuesInList;
bool typeOfOperation;
};
#include "Functions.ipp"
#endif
Я не понимаю, почему это не удается. Могу ли я выдать ошибку в Nvidia или GCC?
Если вы хотите воспроизвести это и получить какие-либо проблемы, не стесняйтесь комментировать, я помогу вам!
С наилучшими пожеланиями, ребята!
Других решений пока нет …