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

Support building cpprestsdk with /MT on Windows #884

Closed
wants to merge 8 commits into from
31 changes: 1 addition & 30 deletions Release/include/cpprest/asyncrt_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,42 +397,13 @@ namespace details
return (uch <= static_cast<UElem>('z') && is_alnum(static_cast<unsigned char>(uch)));
}

/// <summary>
/// Simplistic implementation of make_unique. A better implementation would be based on variadic templates
/// and therefore not be compatible with Dev10.
/// </summary>
template <typename _Type>
std::unique_ptr<_Type> make_unique() {
return std::unique_ptr<_Type>(new _Type());
}

template <typename _Type, typename _Arg1>
std::unique_ptr<_Type> make_unique(_Arg1&& arg1) {
return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1)));
}

template <typename _Type, typename _Arg1, typename _Arg2>
std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2) {
return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2)));
}

template <typename _Type, typename _Arg1, typename _Arg2, typename _Arg3>
std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2, _Arg3&& arg3) {
return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2), std::forward<_Arg3>(arg3)));
}

template <typename _Type, typename _Arg1, typename _Arg2, typename _Arg3, typename _Arg4>
std::unique_ptr<_Type> make_unique(_Arg1&& arg1, _Arg2&& arg2, _Arg3&& arg3, _Arg4&& arg4) {
return std::unique_ptr<_Type>(new _Type(std::forward<_Arg1>(arg1), std::forward<_Arg2>(arg2), std::forward<_Arg3>(arg3), std::forward<_Arg4>(arg4)));
}

/// <summary>
/// Cross platform utility function for performing case insensitive string equality comparision.
/// </summary>
/// <param name="left">First string to compare.</param>
/// <param name="right">Second strong to compare.</param>
/// <returns>true if the strings are equivalent, false otherwise</returns>
_ASYNCRTIMP bool __cdecl str_iequal(const std::string &left, const std::string &right) CPPREST_NOEXCEPT;
_ASYNCRTIMP bool __cdecl str_iequal(const utility::string &left, const utility::string &right) CPPREST_NOEXCEPT;

/// <summary>
/// Cross platform utility function for performing case insensitive string equality comparision.
Expand Down
40 changes: 19 additions & 21 deletions Release/include/cpprest/containerstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ namespace Concurrency { namespace streams {
return m_data;
}

/// <summary>
/// Constructor
/// </summary>
basic_container_buffer(std::ios_base::openmode mode)
: streambuf_state_manager<typename _CollectionType::value_type>(mode),
m_current_position(0) {
validate_mode(mode);
}

/// <summary>
/// Constructor
/// </summary>
basic_container_buffer(_CollectionType data, std::ios_base::openmode mode)
: streambuf_state_manager<typename _CollectionType::value_type>(mode),
m_data(std::move(data)),
m_current_position((mode & std::ios_base::in) ? 0 : m_data.size()) {
validate_mode(mode);
}

/// <summary>
/// Destructor
/// </summary>
Expand Down Expand Up @@ -363,27 +382,6 @@ namespace Concurrency { namespace streams {
private:
template<typename _CollectionType1> friend class streams::container_buffer;

/// <summary>
/// Constructor
/// </summary>
basic_container_buffer(std::ios_base::openmode mode)
: streambuf_state_manager<typename _CollectionType::value_type>(mode),
m_current_position(0)
{
validate_mode(mode);
}

/// <summary>
/// Constructor
/// </summary>
basic_container_buffer(_CollectionType data, std::ios_base::openmode mode)
: streambuf_state_manager<typename _CollectionType::value_type>(mode),
m_data(std::move(data)),
m_current_position((mode & std::ios_base::in) ? 0 : m_data.size())
{
validate_mode(mode);
}

static void validate_mode(std::ios_base::openmode mode)
{
// Disallow simultaneous use of the stream buffer for writing and reading.
Expand Down
Loading