-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #284 from artivis/fix/cast
Fix casting float->double
- Loading branch information
Showing
10 changed files
with
129 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef _MANIF_MANIF_IMPL_CAST_H_ | ||
#define _MANIF_MANIF_IMPL_CAST_H_ | ||
|
||
namespace manif { | ||
namespace internal { | ||
|
||
template <typename Derived, typename NewScalar> | ||
struct CastEvaluatorImpl { | ||
template <typename T> | ||
static auto run(const T& o) -> typename T::template LieGroupTemplate<NewScalar> { | ||
return typename T::template LieGroupTemplate<NewScalar>( | ||
o.coeffs().template cast<NewScalar>() | ||
); | ||
} | ||
}; | ||
|
||
template <typename Derived, typename NewScalar> | ||
struct CastEvaluator : CastEvaluatorImpl<Derived, NewScalar> { | ||
using Base = CastEvaluatorImpl<Derived, NewScalar>; | ||
|
||
CastEvaluator(const Derived& xptr) : xptr_(xptr) {} | ||
|
||
auto run() const -> typename Derived::template LieGroupTemplate<NewScalar> { | ||
return Base::run(xptr_); | ||
} | ||
|
||
protected: | ||
|
||
const Derived& xptr_; | ||
}; | ||
|
||
} // namespace internal | ||
} // namespace manif | ||
|
||
#endif // _MANIF_MANIF_IMPL_CAST_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
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