-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed decltype problem with nvcc compiler. The fix should not influen…
…ce any runtime behavior. Moved lvr2_mesh_builder to lvr2_mesh_tool since the executable is named like this.
- Loading branch information
Showing
9 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef LVR2_UTIL_TYPE_TRAITS_HPP | ||
#define LVR2_UTIL_TYPE_TRAITS_HPP | ||
|
||
#include <type_traits> | ||
|
||
namespace lvr2 { | ||
|
||
/** | ||
* @brief This type trait was necessary to | ||
* | ||
* Usage: | ||
* | ||
* @code | ||
* auto v = vector[0]; | ||
* | ||
* static_assert( | ||
* arg_has_type<Vector<float> >(v), | ||
* "Error: Type mismatch" | ||
* ); | ||
* | ||
* @endcode | ||
* | ||
* Why? | ||
* The following code snipped was compiling in .cpp files but not in .cu | ||
* - Ubuntu 20, GCC 9.4.0, NVCC 12.4 | ||
* | ||
* @code | ||
* auto v = vector[0]; | ||
* | ||
* static_assert( | ||
* std::is_same<decltype(v), BaseVector<float> >::value, | ||
* "Error: Type mismatch" | ||
* ); | ||
* @endcode | ||
* | ||
* Since cuda code sometimes includes BaseVector.hpp all cuda libraries wont compile. | ||
* Problem was that `decltype` in .cu file is not working as expected | ||
* | ||
*/ | ||
template<typename T, typename AutoType> | ||
static constexpr bool arg_has_type(const AutoType& t1) | ||
{ | ||
return std::is_same<T, AutoType>::value; | ||
} | ||
|
||
} // namespace lvr2 | ||
|
||
#endif // LVR2_UTIL_TYPE_TRAITS_HPP |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.