This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <new> | |
#ifdef __CUDACC__ | |
template <class derived_type> | |
struct mask_object { | |
char data[sizeof(derived_type)]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
template <typename T> | |
struct hybrid_pointer { | |
T * cpu_p; | |
#ifdef __CUDACC__ | |
T * gpu_p; | |
#endif | |
T * pointer_to_use; | |
int size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
template <int... Ints> | |
struct basic_int_list {}; | |
template <int... Values> | |
struct strange_int_list {}; | |
template <template <int...> class Container, int... Values> | |
struct working_thing { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This Compiles | |
#include <tuple> | |
template <typename ...T> | |
struct A { | |
template <typename ...U> | |
std::tuple<T..., U...> | |
make(T... x, U... y) { | |
return std::tuple<T..., U...>(x..., y...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
#include "header.hpp" | |
std::unique_ptr<my_class<int>> obj; | |
extern "C" | |
void init_data(int x) { | |
obj = std::make_unique<my_class<int>>(x); | |
} |