@@ -66,28 +66,31 @@ class EigenSparseTile {
6666
6767 // / makes an uninitialized matrix
6868 explicit EigenSparseTile (const range_type& r)
69- : impl_(std::make_shared<impl_type>(
70- std::make_tuple (matrix_type(r.extent()[0], r.extent()[1]), r))) {
71- TA_ASSERT (r.extent ()[0 ] > 0 );
72- TA_ASSERT (r.extent ()[1 ] > 0 );
73- }
69+ : impl_([&]() {
70+ TA_ASSERT (r.extent ()[0 ] > 0 );
71+ TA_ASSERT (r.extent ()[1 ] > 0 );
72+ return std::make_shared<impl_type>(
73+ std::make_tuple (matrix_type (r.extent ()[0 ], r.extent ()[1 ]), r));
74+ }()) {}
7475
7576 // / ctor using sparse matrix
7677 EigenSparseTile (matrix_type&& mat, const range_type& range)
77- : impl_(std::make_shared<impl_type>(
78- std::make_tuple (std::move(mat), range))) {
79- using extent_type = typename range_type::extent_type::value_type;
80- TA_ASSERT (static_cast <extent_type>(mat.rows ()) == range.extent ()[0 ]);
81- TA_ASSERT (static_cast <extent_type>(mat.cols ()) == range.extent ()[1 ]);
82- }
78+ : impl_([&]() {
79+ using extent_type = typename range_type::extent_type::value_type;
80+ TA_ASSERT (static_cast <extent_type>(mat.rows ()) == range.extent ()[0 ]);
81+ TA_ASSERT (static_cast <extent_type>(mat.cols ()) == range.extent ()[1 ]);
82+ return std::make_shared<impl_type>(
83+ std::make_tuple (std::move (mat), range));
84+ }()) {}
8385
8486 // / ctor using sparse matrix
8587 EigenSparseTile (const matrix_type& mat, const range_type& range)
86- : impl_(std::make_shared<impl_type>(std::make_tuple(mat, range))) {
87- using extent_type = typename range_type::extent_type::value_type;
88- TA_ASSERT (static_cast <extent_type>(mat.rows ()) == range.extent ()[0 ]);
89- TA_ASSERT (static_cast <extent_type>(mat.cols ()) == range.extent ()[1 ]);
90- }
88+ : impl_([&]() {
89+ using extent_type = typename range_type::extent_type::value_type;
90+ TA_ASSERT (static_cast <extent_type>(mat.rows ()) == range.extent ()[0 ]);
91+ TA_ASSERT (static_cast <extent_type>(mat.cols ()) == range.extent ()[1 ]);
92+ return std::make_shared<impl_type>(std::make_tuple (mat, range));
93+ }()) {}
9194
9295 // Deep copy
9396 EigenSparseTile clone () const {
@@ -683,15 +686,15 @@ struct ArchiveLoadImpl<Archive, Eigen::Triplet<T>> {
683686 static inline void load (const Archive& ar, Eigen::Triplet<T>& obj) {
684687 int row, col;
685688 T value;
686- ar & row & col & value;
689+ ar& row& col& value;
687690 obj = Eigen::Triplet<T>(row, col, value);
688691 }
689692};
690693
691694template <class Archive , typename T>
692695struct ArchiveStoreImpl <Archive, Eigen::Triplet<T>> {
693696 static inline void store (const Archive& ar, const Eigen::Triplet<T>& obj) {
694- ar & obj.row () & obj.col () & obj.value ();
697+ ar& obj.row () & obj.col () & obj.value ();
695698 }
696699};
697700} // namespace archive
0 commit comments