Remove tl::optional and use absl::optional always

pull/267/head
Michael 5 years ago
parent 41f9f5fad6
commit 6055829df4
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -41,7 +41,9 @@ if (WIN32 AND NOT STATIC_LINK)
set(STATIC_LINK ON)
endif(WIN32 AND NOT STATIC_LINK)
add_subdirectory(vendor/abseil-cpp)
set(ABSEIL_DIR vendor/abseil-cpp)
add_subdirectory(${ABSEIL_DIR})
include_directories(${ABSEIL_DIR})
# turns off those annoying warnings for
# target-specific crypto code paths not
@ -739,6 +741,7 @@ else()
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
target_link_libraries(${UTIL_LIB} absl::optional)
add_library(${PLATFORM_LIB} STATIC ${LIB_PLATFORM_SRC})
if(USE_LIBABYSS)

File diff suppressed because it is too large Load Diff

@ -5,11 +5,7 @@
#include <service/types.hpp>
#include <util/bencode.hpp>
#if __cplusplus >= 201703L
#include <optional>
#else
#include <tl/optional.hpp>
#endif
#include <absl/types/optional.h>
namespace llarp
{
@ -26,11 +22,7 @@ namespace llarp
public:
VanityNonce vanity;
#if __cplusplus >= 201703L
using OptNonce = std::optional< VanityNonce >;
#else
using OptNonce = tl::optional< VanityNonce >;
#endif
using OptNonce = absl::optional< VanityNonce >;
ServiceInfo() = default;

@ -4,12 +4,8 @@
#include <util/queue_manager.hpp>
#include <util/threading.hpp>
#include <absl/types/optional.h>
#include <atomic>
#if __cplusplus >= 201703L
#include <optional>
#else
#include <tl/optional.hpp>
#endif
#include <tuple>
namespace llarp
@ -76,11 +72,8 @@ namespace llarp
// Remove an element from the queue. Block until an element is available
Type
popFront();
#if __cplusplus >= 201703L
std::optional< Type >
#else
tl::optional< Type >
#endif
absl::optional< Type >
tryPopFront();
// Remove all elements from the queue. Note this is not atomic, and if
@ -267,11 +260,7 @@ namespace llarp
}
template < typename Type >
#if __cplusplus >= 201703L
std::optional< Type >
#else
tl::optional< Type >
#endif
absl::optional< Type >
Queue< Type >::tryPopFront()
{
uint32_t generation;
@ -296,11 +285,7 @@ namespace llarp
// - notify any waiting pushers
QueuePopGuard< Type > popGuard(*this, generation, index);
#if __cplusplus >= 201703L
return std::optional< Type >(std::move(m_data[index]));
#else
return tl::optional< Type >(std::move(m_data[index]));
#endif
return absl::optional< Type >(std::move(m_data[index]));
}
template < typename Type >

@ -572,12 +572,8 @@ TEST(TestQueue, moveIt)
(void)popped;
ASSERT_EQ(5u, counter);
#if __cplusplus >= 201703L
std::optional< MoveTester >
#else
tl::optional< MoveTester >
#endif
optPopped = queue.tryPopFront();
absl::optional< MoveTester > optPopped = queue.tryPopFront();
ASSERT_TRUE(optPopped.has_value());

@ -1,10 +1,6 @@
#include <util/queue_manager.hpp>
#if __cplusplus >= 201703L
#include <optional>
#else
#include <tl/optional.hpp>
#endif
#include <absl/types/optional.h>
#include <vector>
#include <gtest/gtest.h>
@ -78,11 +74,8 @@ class IntQueue
return false;
}
}
#if __cplusplus >= 201703L
std::optional< int >
#else
tl::optional< int >
#endif
absl::optional< int >
tryPopFront()
{
uint32_t gen = 0;

Loading…
Cancel
Save