Function fromString

Summary

#include <lib/inc/drogon/utils/Utilities.h>

(1) template <typename T>
    std::enable_if< internal::CanConvertFromStringStream< T >::value, T >::type fromString(const std::string &p) noexcept(false)

(2) template <typename T>
    std::enable_if<!(internal::CanConvertFromStringStream< T >::value), T >::type fromString(const std::string &) noexcept(false)

Function overload

Synopsis

#include <lib/inc/drogon/utils/Utilities.h>

template <typename T>
std::enable_if< internal::CanConvertFromStringStream< T >::value, T >::type fromString(const std::string &p) noexcept(false)

Description

No description yet.

Source

Lines 309-320 in lib/inc/drogon/utils/Utilities.h.

template <typename T>
typename std::enable_if<internal::CanConvertFromStringStream<T>::value, T>::type
fromString(const std::string &p) noexcept(false)
{
    T value{};
    if (!p.empty())
    {
        std::stringstream ss(p);
        ss >> value;
    }
    return value;
}

Synopsis

#include <lib/inc/drogon/utils/Utilities.h>

template <typename T>
std::enable_if<!(internal::CanConvertFromStringStream< T >::value), T >::type fromString(const std::string &) noexcept(false)

Description

No description yet.

Source

Lines 322-328 in lib/inc/drogon/utils/Utilities.h.

template <typename T>
typename std::enable_if<!(internal::CanConvertFromStringStream<T>::value),
                        T>::type
fromString(const std::string &) noexcept(false)
{
    throw std::runtime_error("Bad type conversion");
}





Add Discussion as Guest

Log in