mirror of
https://github.com/boostorg/mpi.git
synced 2026-02-27 05:02:33 +00:00
Templated string serialization on the char type
[SVN r56138]
This commit is contained in:
@@ -88,7 +88,8 @@ public:
|
||||
load_impl(&t, sizeof(T));
|
||||
}
|
||||
|
||||
void load( std::string & s)
|
||||
template<class CharType>
|
||||
void load(std::basic_string<CharType> & s)
|
||||
{
|
||||
unsigned int l;
|
||||
load(l);
|
||||
|
||||
@@ -79,7 +79,8 @@ public:
|
||||
save_impl(&t, sizeof(T));
|
||||
}
|
||||
|
||||
void save(const std::string &s)
|
||||
template<class CharType>
|
||||
void save(const std::basic_string<CharType> &s)
|
||||
{
|
||||
unsigned int l = static_cast<unsigned int>(s.size());
|
||||
save(l);
|
||||
|
||||
@@ -86,7 +86,8 @@ public:
|
||||
load_impl(&t, get_mpi_datatype(t), 1);
|
||||
}
|
||||
|
||||
void load( std::string & s)
|
||||
template<class CharType>
|
||||
void load(std::basic_string<CharType> & s)
|
||||
{
|
||||
unsigned int l;
|
||||
load(l);
|
||||
@@ -96,7 +97,7 @@ public:
|
||||
#endif
|
||||
s.resize(l);
|
||||
// note breaking a rule here - could be a problem on some platform
|
||||
load_impl(const_cast<char *>(s.data()),MPI_CHAR,l);
|
||||
load_impl(const_cast<char *>(s.data()),get_mpi_datatype(CharType()),l);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -77,11 +77,12 @@ public:
|
||||
save_impl(&t, get_mpi_datatype<T>(t), 1);
|
||||
}
|
||||
|
||||
void save(const std::string &s)
|
||||
template<class CharType>
|
||||
void save(const std::basic_string<CharType> &s)
|
||||
{
|
||||
unsigned int l = static_cast<unsigned int>(s.size());
|
||||
save(l);
|
||||
save_impl(s.data(),MPI_CHAR,s.size());
|
||||
save_impl(s.data(),get_mpi_datatype(CharType()),s.size());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -59,9 +59,9 @@ private:
|
||||
* underlying MPI_Comm. This operation is used for "casting" from a
|
||||
* communicator to an intercommunicator.
|
||||
*/
|
||||
explicit intercommunicator(const shared_ptr<MPI_Comm>& comm_ptr)
|
||||
explicit intercommunicator(const shared_ptr<MPI_Comm>& cp)
|
||||
{
|
||||
this->comm_ptr = comm_ptr;
|
||||
this->comm_ptr = cp;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user