Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly force G3TimestreamMap to have assignment operators #102

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/include/core/G3Timestream.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ class G3TimestreamMap : public G3FrameObject,
G3TimestreamMap(const G3TimestreamMap& other):std::map<std::string, G3TimestreamPtr>(other){}
G3TimestreamMap(G3TimestreamMap&& other):std::map<std::string, G3TimestreamPtr>(std::move(other)){}

G3TimestreamMap& operator=(const G3TimestreamMap&)=default;
G3TimestreamMap& operator=(G3TimestreamMap&&)=default;

// Return true if all timestreams start and end at the same time and
// contain the same number of samples.
bool CheckAlignment() const;
Expand Down
18 changes: 18 additions & 0 deletions core/tests/G3TimestreamMapTest.cxx
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
#include <G3Test.h>

#include <type_traits>

#include <core/G3Timestream.h>

#include <boost/make_shared.hpp>

TEST_GROUP(G3TimestreamMap)

//These things can be checked purely at compile time
static_assert(std::is_default_constructible<G3TimestreamMap>::value,
"G3TimestreamMap must be default constructible");

static_assert(std::is_copy_constructible<G3TimestreamMap>::value,
"G3TimestreamMap must be copy constructible");

static_assert(std::is_move_constructible<G3TimestreamMap>::value,
"G3TimestreamMap must be move constructible");

static_assert(std::is_copy_assignable<G3TimestreamMap>::value,
"G3TimestreamMap must be copy assignable");

static_assert(std::is_move_assignable<G3TimestreamMap>::value,
"G3TimestreamMap must be move assignable");

template<typename SampleType>
void testMakeCompact(){
std::vector<std::string> keys={"a","b","c","d"};
Expand Down