forked from QMCPACK/qmcpack
-
Notifications
You must be signed in to change notification settings - Fork 0
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 QMCPACK#4825 from ye-luo/value-alias
Add ValueAlias for ValueType reconstruction
- Loading branch information
Showing
3 changed files
with
88 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
////////////////////////////////////////////////////////////////////////////////////// | ||
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2023 QMCPACK developers | ||
// | ||
// File developed by: Ye Luo, [email protected], Argonne National Laboratory | ||
// | ||
// File created by: Ye Luo, [email protected], Argonne National Laboratory | ||
////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "catch.hpp" | ||
#include "type_traits/complex_help.hpp" | ||
|
||
namespace qmcplusplus | ||
{ | ||
template<typename P> | ||
class TestComplexHelper | ||
{ | ||
using Cmplx = std::complex<P>; | ||
using Real = RealAlias<Cmplx>; | ||
using CmplxRebuild = ValueAlias<P, Cmplx>; | ||
using RealRebuild = ValueAlias<P, Real>; | ||
|
||
public: | ||
void run() | ||
{ | ||
Cmplx aa; | ||
CmplxRebuild bb; | ||
aa = bb; | ||
|
||
Real cc; | ||
RealRebuild dd(0); | ||
cc = dd; | ||
} | ||
}; | ||
|
||
TEST_CASE("complex_helper", "[type_traits]") | ||
{ | ||
TestComplexHelper<float> float_test; | ||
float_test.run(); | ||
TestComplexHelper<double> double_test; | ||
double_test.run(); | ||
} | ||
|
||
} // namespace qmcplusplus |