summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ocl/detail/posix/net_config.hpp (renamed from include/ocl/detail/net_config.hpp)0
-rw-r--r--include/ocl/is_same.hpp30
-rw-r--r--include/ocl/option.hpp12
-rw-r--r--include/ocl/posix/unique_socket.hpp (renamed from include/ocl/unique_socket.hpp)2
-rw-r--r--include/ocl/print.hpp3
-rw-r--r--include/ocl/smart_ptr.hpp1
-rw-r--r--include/ocl/smart_socket.hpp5
7 files changed, 26 insertions, 27 deletions
diff --git a/include/ocl/detail/net_config.hpp b/include/ocl/detail/posix/net_config.hpp
index 671d4ba..671d4ba 100644
--- a/include/ocl/detail/net_config.hpp
+++ b/include/ocl/detail/posix/net_config.hpp
diff --git a/include/ocl/is_same.hpp b/include/ocl/is_same.hpp
index ec3eb66..2ad6db5 100644
--- a/include/ocl/is_same.hpp
+++ b/include/ocl/is_same.hpp
@@ -14,7 +14,7 @@
namespace ocl
{
template <typename T>
- struct basic_hash
+ struct basic_hash final
{
using result_type = typename T::result_type;
using type = T;
@@ -29,13 +29,10 @@ namespace ocl
template <typename T, typename U>
struct is_same
{
- static constexpr bool value = false;
+ using left_type = T;
+ using right_type = T;
- /// @brief check if hash matches what we expect.
- constexpr bool operator()() noexcept
- {
- return T::hash() == U::hash();
- }
+ static constexpr bool value = false;
};
template <typename T>
@@ -47,12 +44,10 @@ namespace ocl
template <typename T, typename U>
struct is_not_same
{
- static constexpr bool value = true;
+ using left_type = T;
+ using right_type = T;
- constexpr bool operator()() noexcept
- {
- return T::hash() != U::hash();
- }
+ static constexpr bool value = true;
};
template <typename T>
@@ -62,7 +57,7 @@ namespace ocl
};
template <typename T>
- struct equiv_is_int8
+ struct equiv_is_int8 final
{
private:
T left_ = 127, right_ = 127;
@@ -77,7 +72,7 @@ namespace ocl
};
template <typename T>
- struct equiv_not_int8
+ struct equiv_not_int8 final
{
private:
// these shall overflow if not int8.
@@ -93,7 +88,7 @@ namespace ocl
};
template <typename T>
- struct equiv_is_real
+ struct equiv_is_real final
{
private:
T left_ = 5, right_ = 3;
@@ -108,17 +103,18 @@ namespace ocl
};
template <typename T>
- struct equiv_is
+ struct equiv_is final
{
private:
T left_{}, right_{};
public:
using result_type = bool;
+ using type = T;
constexpr result_type hash()
{
- return (left_ / right_);
+ return (left_ == right_);
}
};
} // namespace ocl
diff --git a/include/ocl/option.hpp b/include/ocl/option.hpp
index 9286ef9..a73ccb0 100644
--- a/include/ocl/option.hpp
+++ b/include/ocl/option.hpp
@@ -21,11 +21,11 @@ namespace ocl
};
template <typename char_type = char>
- struct option final
+ class option final
{
+ public:
option() = delete;
-
- option(const return_type& return_type)
+ explicit option(const return_type& return_type)
: ret_(return_type)
{
}
@@ -68,7 +68,7 @@ namespace ocl
namespace detail
{
- struct int_eq_teller
+ struct int_eq_teller final
{
bool operator()(int a, int b)
{
@@ -76,7 +76,7 @@ namespace ocl
}
};
- struct int_greater_than_teller
+ struct int_greater_than_teller final
{
bool operator()(int a, int b)
{
@@ -84,7 +84,7 @@ namespace ocl
}
};
- struct int_less_than_teller
+ struct int_less_than_teller final
{
bool operator()(int a, int b)
{
diff --git a/include/ocl/unique_socket.hpp b/include/ocl/posix/unique_socket.hpp
index 053b7e9..f094e54 100644
--- a/include/ocl/unique_socket.hpp
+++ b/include/ocl/posix/unique_socket.hpp
@@ -9,7 +9,7 @@
#define __OCL_CORE_SOCKET
#include <ocl/detail/config.hpp>
-#include <ocl/detail/net_config.hpp>
+#include <ocl/detail/posix/net_config.hpp>
namespace ocl
{
diff --git a/include/ocl/print.hpp b/include/ocl/print.hpp
index 02b3044..ea6b483 100644
--- a/include/ocl/print.hpp
+++ b/include/ocl/print.hpp
@@ -9,7 +9,6 @@
#define __OCL_CORE_PRINT
#include <ocl/detail/config.hpp>
-
#include <iostream>
#define console_io_out std::cout
@@ -25,6 +24,8 @@ namespace ocl::io
inline void print() noexcept
{
+ extern void lf() noexcept;
+ lf();
}
template <typename... Args>
diff --git a/include/ocl/smart_ptr.hpp b/include/ocl/smart_ptr.hpp
index 333e460..23671f1 100644
--- a/include/ocl/smart_ptr.hpp
+++ b/include/ocl/smart_ptr.hpp
@@ -24,7 +24,6 @@ namespace ocl
/// @brief Constructs a `delete_ptr`, that is, a pointer that isn't deleted from the heap.
template<class T>
inline auto delete_ptr(T* object) -> auto { return shared_ptr<T>{ object, boost::null_deleter{}}; }
-
}
#endif // ifndef __OCL_SMART_PTR \ No newline at end of file
diff --git a/include/ocl/smart_socket.hpp b/include/ocl/smart_socket.hpp
index cba177c..81094fd 100644
--- a/include/ocl/smart_socket.hpp
+++ b/include/ocl/smart_socket.hpp
@@ -9,7 +9,10 @@
#define __OCL_SMART_SOCKET
#include <ocl/detail/config.hpp>
-#include <ocl/unique_socket.hpp>
#include <boost/asio.hpp>
+#ifdef OCL_POSIX
+# include <ocl/posix/unique_socket.hpp>
+#endif
+
#endif // __OCL_SMART_SOCKET \ No newline at end of file