Skip to content

Commit

Permalink
fixing broken build
Browse files Browse the repository at this point in the history
  • Loading branch information
patflick committed Sep 19, 2016
1 parent 57c9229 commit b3ab1d4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
28 changes: 23 additions & 5 deletions experimental/new_datatype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,33 @@ struct buffer_decl {
typedef buf_instance<buffer_decl<T, U, S>> instance_type;

// pointer to member
S T::* size;
U* T::* buf;
S T::* m_size;
U* T::* m_buf;

instance_type instance_wrapper(T& t) {
return instance_type(*this, t);
}

constexpr buffer_decl(S T::* size, U* T::* buf) : size(size), buf(buf) {}
constexpr buffer_decl(const buffer_decl& o) : size(o.size), buf(o.buf) {}
inline size_type size(const T& instance) const {
return instance.*m_size;
}

inline const value_type* data(const T& instance) const {
return instance.*m_buf;
}

inline value_type* data(T& instance) const {
return instance.*m_buf;
}

inline void resize(T& instance, size_type size) {
// TODO dealloc?
instance.*m_size = size;
instance.*m_buf = new value_type[size];
}

constexpr buffer_decl(S T::* size, U* T::* buf) : m_size(size), m_buf(buf) {}
constexpr buffer_decl(const buffer_decl& o) : m_size(o.size), m_buf(o.buf) {}
};


Expand Down Expand Up @@ -334,7 +352,7 @@ struct is_simple_type_helper<T, typename std::enable_if<
> {};

template <typename T>
struct is_simple_type : public is_simple_type_helper<T> {};
struct is_simple_type : is_simple_type_helper<T> {};


template <typename T, typename Alloc>
Expand Down
4 changes: 2 additions & 2 deletions experimental/sendrecv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace mxx {

template <typename T>
typename std::enable_if<mxx::is_trivial_type<T>::value, void>::type
typename std::enable_if<mxx::is_simple_type<T>::value, void>::type
sendrecv(const T* send_data, size_t send_count, int target, T* recv_buf, size_t recv_count, int src, const mxx::comm& c) {
mxx::datatype dt = mxx::get_datatype<T>();
if (send_count >= mxx::max_int || recv_count >= mxx::max_int) {
Expand All @@ -26,7 +26,7 @@ sendrecv(const T* send_data, size_t send_count, int target, T* recv_buf, size_t


template <typename T>
typename std::enable_if<mxx::is_trivial_type<T>::value, T>::type
typename std::enable_if<mxx::is_simple_type<T>::value, T>::type
sendrecv(const T& value, int target, int src, const mxx::comm& c) {
mxx::datatype dt = mxx::get_datatype<T>();
T result = T();
Expand Down
2 changes: 1 addition & 1 deletion include/mxx/datatypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ struct datatype_name {
datatype_name(datatype_name&& o) = default;
};

std::ostream& operator<<(std::ostream& os, const datatype_name& n) {
inline std::ostream& operator<<(std::ostream& os, const datatype_name& n) {
return os << "(" << n.mpi_name << "," << n.c_name << "," << n.typeid_name << ")";
}

Expand Down

0 comments on commit b3ab1d4

Please sign in to comment.