-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into mat_as_array
- Loading branch information
Showing
9 changed files
with
148 additions
and
36 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
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,31 @@ | ||
// | ||
// Created by hugo on 28/11/23. | ||
// | ||
|
||
#ifndef SOFA_ISRIGIDTYPE_H | ||
#define SOFA_ISRIGIDTYPE_H | ||
|
||
namespace sofa::type | ||
{ | ||
// Boiler-plate code to test if a type implements a method | ||
// explanation https://stackoverflow.com/a/30848101 | ||
|
||
template <typename...> | ||
using void_t = void; | ||
|
||
// Primary template handles all types not supporting the operation. | ||
template <typename, template <typename> class, typename = void_t<>> | ||
struct detect : std::false_type {}; | ||
|
||
// Specialization recognizes/validates only types supporting the archetype. | ||
template <typename T, template <typename> class Op> | ||
struct detect<T, Op, void_t<Op<T>>> : std::true_type {}; | ||
|
||
// Actual test if DataType::Coord implements getOrientation() (hence is a RigidType) | ||
template <typename T> | ||
using isRigid_t = decltype(std::declval<typename T::Coord>().getOrientation()); | ||
|
||
template <typename T> | ||
using isRigidType = detect<T, isRigid_t>; | ||
} | ||
#endif //SOFA_ISRIGIDTYPE_H |
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