summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-03-21 18:15:57 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2020-03-28 13:22:32 +0000
commita5b232bba6a49f0fbb4e038348cbc21f06b3a372 (patch)
tree22063c5138dc102707390fc148b1c85b55a0db2b
parentRefactor ProcessPipes to get rid of that awkward feeling (diff)
downloadlibadhocutil-a5b232bba6a49f0fbb4e038348cbc21f06b3a372.tar.bz2
libadhocutil-a5b232bba6a49f0fbb4e038348cbc21f06b3a372.tar.xz
libadhocutil-a5b232bba6a49f0fbb4e038348cbc21f06b3a372.zip
Fixes for tidy
-rw-r--r--libadhocutil/compileTimeFormatter.h6
-rw-r--r--libadhocutil/curlHandle.cpp5
-rw-r--r--libadhocutil/curlMultiHandle.cpp8
-rw-r--r--libadhocutil/curlStream.cpp5
-rw-r--r--libadhocutil/fileUtils.cpp255
-rw-r--r--libadhocutil/lazyPointer.h1
-rw-r--r--libadhocutil/lexer-regex.cpp127
-rw-r--r--libadhocutil/runtimeContext.cpp5
-rw-r--r--libadhocutil/unittests/testCompileTimeFormatter.cpp15
-rw-r--r--libadhocutil/unittests/testCurl.cpp10
-rw-r--r--libadhocutil/unittests/testLazyPointer.cpp8
11 files changed, 210 insertions, 235 deletions
diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h
index 12685bc..ba243c6 100644
--- a/libadhocutil/compileTimeFormatter.h
+++ b/libadhocutil/compileTimeFormatter.h
@@ -3,6 +3,7 @@
#include <sstream>
#include <cstring>
+#include <array>
#include <boost/preprocessor/variadic/size.hpp>
#include "unique.h"
@@ -182,11 +183,9 @@ namespace AdHoc {
{
if (pos != L) {
constexpr auto ph = strchrnul<S, '%', pos, L>();
- // NOLINTNEXTLINE(hicpp-braces-around-statements,bugprone-suspicious-semicolon)
if constexpr (ph != pos) {
- appendStream(s, (S + pos), ph - pos);
+ appendStream(s, &S[pos], ph - pos);
}
- // NOLINTNEXTLINE(hicpp-braces-around-statements,bugprone-suspicious-semicolon)
if constexpr (ph != L) {
packAndWrite<ph>(s, pn...);
}
@@ -196,7 +195,6 @@ namespace AdHoc {
template<strlen_t ph, strlen_t off = 0, auto ... Pck>
static inline void packAndWrite(stream & s, const Pn & ... pn)
{
- // NOLINTNEXTLINE(hicpp-braces-around-statements)
if constexpr (ph + off == L || sizeof...(Pck) == 32) {
StreamWriter<S, L, ph, stream, void, Pck...>::write(s, pn...);
}
diff --git a/libadhocutil/curlHandle.cpp b/libadhocutil/curlHandle.cpp
index 7009ee5..a976410 100644
--- a/libadhocutil/curlHandle.cpp
+++ b/libadhocutil/curlHandle.cpp
@@ -3,9 +3,7 @@
#include <boost/numeric/conversion/cast.hpp>
#include "compileTimeFormatter.h"
-// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
-namespace AdHoc {
-namespace Net {
+namespace AdHoc::Net {
static void cleanup() __attribute__((destructor));
static void cleanup()
@@ -136,5 +134,4 @@ CurlException::ice_print(std::ostream & s) const
}
}
-}
diff --git a/libadhocutil/curlMultiHandle.cpp b/libadhocutil/curlMultiHandle.cpp
index 65e9464..5db8c3f 100644
--- a/libadhocutil/curlMultiHandle.cpp
+++ b/libadhocutil/curlMultiHandle.cpp
@@ -4,9 +4,7 @@
#include "runtimeContext.h"
#include "curlStream.h"
-// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
-namespace AdHoc {
-namespace Net {
+namespace AdHoc::Net {
class RunningCurl : public CurlStreamSource {
public:
@@ -57,10 +55,9 @@ CurlMultiHandle::performAll()
while (!curls.empty() && running.size() < 5) {
addRunner(curlm, running, curls);
}
- CURLMcode code;
int act = running.size();
while (act) {
- while ((code = curl_multi_perform(curlm, &act)) == CURLM_CALL_MULTI_PERFORM) {}
+ while (curl_multi_perform(curlm, &act) == CURLM_CALL_MULTI_PERFORM) {}
// Has anything finished
CURLMsg * msg;
int msgs = 0;
@@ -95,5 +92,4 @@ CurlMultiHandle::performAll()
}
}
-}
diff --git a/libadhocutil/curlStream.cpp b/libadhocutil/curlStream.cpp
index 3fb441f..6784675 100644
--- a/libadhocutil/curlStream.cpp
+++ b/libadhocutil/curlStream.cpp
@@ -1,8 +1,6 @@
#include "curlStream.h"
-// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
-namespace AdHoc {
-namespace Net {
+namespace AdHoc::Net {
CurlStreamSource::CurlStreamSource(const std::string & url) :
CurlHandle(url),
@@ -58,5 +56,4 @@ CurlStreamSource::recv(void * data, size_t datalen)
}
}
-}
diff --git a/libadhocutil/fileUtils.cpp b/libadhocutil/fileUtils.cpp
index 72d025f..b4d39b4 100644
--- a/libadhocutil/fileUtils.cpp
+++ b/libadhocutil/fileUtils.cpp
@@ -5,163 +5,160 @@
#include <sys/mman.h>
#include <boost/assert.hpp>
-// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
-namespace AdHoc {
- namespace FileUtils {
- AdHocFormatter(FD, "FD %?");
-
- std::filesystem::path operator/(const std::filesystem::path & p, unsigned int n)
- {
- auto pp = p.begin();
- while (n--) {
- ++pp;
- }
- return *pp;
- }
+namespace AdHoc::FileUtils {
+ AdHocFormatter(FD, "FD %?");
- FileHandle::FileHandle(int d) noexcept :
- fh(d)
- {
+ std::filesystem::path operator/(const std::filesystem::path & p, unsigned int n)
+ {
+ auto pp = p.begin();
+ while (n--) {
+ ++pp;
}
+ return *pp;
+ }
- FileHandle::FileHandle(FileHandle && o) noexcept :
- fh(o.fh)
- {
- const_cast<int &>(o.fh) = -1;
- }
+ FileHandle::FileHandle(int d) noexcept :
+ fh(d)
+ {
+ }
- FileHandle &
- FileHandle::operator=(FileHandle && o) noexcept
- {
- const_cast<int &>(fh) = o.fh;
- const_cast<int &>(o.fh) = -1;
- return *this;
- }
+ FileHandle::FileHandle(FileHandle && o) noexcept :
+ fh(o.fh)
+ {
+ const_cast<int &>(o.fh) = -1;
+ }
- FileHandle::FileHandle(const std::filesystem::path & path, int flags) :
- fh(open(path.c_str(), flags))
- {
- if (fh < 0) {
- throw SystemExceptionOn("open(2) failed", strerror(errno), errno, path);
- }
- }
+ FileHandle &
+ FileHandle::operator=(FileHandle && o) noexcept
+ {
+ const_cast<int &>(fh) = o.fh;
+ const_cast<int &>(o.fh) = -1;
+ return *this;
+ }
- FileHandle::FileHandle(const std::filesystem::path & path, int flags, int mode) :
- fh(open(path.c_str(), flags, mode))
- {
- if (fh < 0) {
- throw SystemExceptionOn("open(2) failed", strerror(errno), errno, path);
- }
+ FileHandle::FileHandle(const std::filesystem::path & path, int flags) :
+ fh(open(path.c_str(), flags))
+ {
+ if (fh < 0) {
+ throw SystemExceptionOn("open(2) failed", strerror(errno), errno, path);
}
+ }
- FileHandle::~FileHandle() noexcept
- {
- if (fh >= 0) {
- BOOST_VERIFY(close(fh) == 0);
- }
+ FileHandle::FileHandle(const std::filesystem::path & path, int flags, int mode) :
+ fh(open(path.c_str(), flags, mode))
+ {
+ if (fh < 0) {
+ throw SystemExceptionOn("open(2) failed", strerror(errno), errno, path);
}
+ }
- FileHandle::operator int() const noexcept
- {
- return fh;
+ FileHandle::~FileHandle() noexcept
+ {
+ if (fh >= 0) {
+ BOOST_VERIFY(close(fh) == 0);
}
+ }
- FileHandleStat::FileHandleStat(int fd) :
- FileHandle(fd),
- st({})
- {
- refreshStat();
- }
+ FileHandle::operator int() const noexcept
+ {
+ return fh;
+ }
- FileHandleStat::FileHandleStat(const std::filesystem::path & path, int flags) :
- FileHandle(path, flags),
- st({})
- {
- refreshStat(path);
- }
+ FileHandleStat::FileHandleStat(int fd) :
+ FileHandle(fd),
+ st({})
+ {
+ refreshStat();
+ }
- FileHandleStat::FileHandleStat(const std::filesystem::path & path, int flags, int mode) :
- FileHandle(path, flags, mode),
- st({})
- {
- refreshStat(path);
- }
+ FileHandleStat::FileHandleStat(const std::filesystem::path & path, int flags) :
+ FileHandle(path, flags),
+ st({})
+ {
+ refreshStat(path);
+ }
- const struct stat &
- FileHandleStat::getStat() const noexcept
- {
- return st;
- }
+ FileHandleStat::FileHandleStat(const std::filesystem::path & path, int flags, int mode) :
+ FileHandle(path, flags, mode),
+ st({})
+ {
+ refreshStat(path);
+ }
- const struct stat &
- FileHandleStat::refreshStat()
- {
- if (fstat(fh, &st)) {
- // LCOV_EXCL_START can't think of a way to test open succeeding and fstat failing
- throw SystemExceptionOn("fstat(2) failed", strerror(errno), errno, FD::get(fh));
- // LCOV_EXCL_STOP
- }
- return st;
- }
+ const struct stat &
+ FileHandleStat::getStat() const noexcept
+ {
+ return st;
+ }
- void
- FileHandleStat::refreshStat(const std::filesystem::path & path)
- {
- if (fstat(fh, &st)) {
- // LCOV_EXCL_START can't think of a way to test open succeeding and fstat failing
- throw SystemExceptionOn("fstat(2) failed", strerror(errno), errno, path);
- // LCOV_EXCL_STOP
- }
+ const struct stat &
+ FileHandleStat::refreshStat()
+ {
+ if (fstat(fh, &st)) {
+ // LCOV_EXCL_START can't think of a way to test open succeeding and fstat failing
+ throw SystemExceptionOn("fstat(2) failed", strerror(errno), errno, FD::get(fh));
+ // LCOV_EXCL_STOP
}
+ return st;
+ }
- MemMap::MemMap(int d, int flags) :
- FileHandleStat(d),
- data(setupMap(flags))
- {
+ void
+ FileHandleStat::refreshStat(const std::filesystem::path & path)
+ {
+ if (fstat(fh, &st)) {
+ // LCOV_EXCL_START can't think of a way to test open succeeding and fstat failing
+ throw SystemExceptionOn("fstat(2) failed", strerror(errno), errno, path);
+ // LCOV_EXCL_STOP
}
+ }
- MemMap::MemMap(const std::filesystem::path & path, int flags) :
- FileHandleStat(path, flags),
- data(setupMap(path, flags))
- {
- }
+ MemMap::MemMap(int d, int flags) :
+ FileHandleStat(d),
+ data(setupMap(flags))
+ {
+ }
- MemMap::MemMap(const std::filesystem::path & path, int flags, int mode) :
- FileHandleStat(path, flags, mode),
- data(setupMap(path, flags))
- {
- }
+ MemMap::MemMap(const std::filesystem::path & path, int flags) :
+ FileHandleStat(path, flags),
+ data(setupMap(path, flags))
+ {
+ }
- MemMap::~MemMap()
- {
- munmap(const_cast<void *>(data), st.st_size);
- }
+ MemMap::MemMap(const std::filesystem::path & path, int flags, int mode) :
+ FileHandleStat(path, flags, mode),
+ data(setupMap(path, flags))
+ {
+ }
- void *
- MemMap::setupMapInt(int flags) const
- {
- return mmap(nullptr, st.st_size, flags & (O_WRONLY | O_RDWR) ? PROT_WRITE : PROT_READ, MAP_SHARED, fh, 0);
- }
+ MemMap::~MemMap()
+ {
+ munmap(const_cast<void *>(data), st.st_size);
+ }
+
+ void *
+ MemMap::setupMapInt(int flags) const
+ {
+ return mmap(nullptr, st.st_size, flags & (O_WRONLY | O_RDWR) ? PROT_WRITE : PROT_READ, MAP_SHARED, fh, 0);
+ }
- void *
- MemMap::setupMap(int flags) const
- {
- auto data = setupMapInt(flags);
- if (data == reinterpret_cast<void *>(-1)) {
- throw SystemExceptionOn("mmap(2) failed", strerror(errno), errno, FD::get(fh));
- }
- return data;
+ void *
+ MemMap::setupMap(int flags) const
+ {
+ auto data = setupMapInt(flags);
+ if (data == reinterpret_cast<void *>(-1)) {
+ throw SystemExceptionOn("mmap(2) failed", strerror(errno), errno, FD::get(fh));
}
+ return data;
+ }
- void *
- MemMap::setupMap(const std::filesystem::path & path, int flags) const
- {
- auto data = setupMapInt(flags);
- if (data == reinterpret_cast<void *>(-1)) {
- throw SystemExceptionOn("mmap(2) failed", strerror(errno), errno, path);
- }
- return data;
+ void *
+ MemMap::setupMap(const std::filesystem::path & path, int flags) const
+ {
+ auto data = setupMapInt(flags);
+ if (data == reinterpret_cast<void *>(-1)) {
+ throw SystemExceptionOn("mmap(2) failed", strerror(errno), errno, path);
}
+ return data;
}
}
diff --git a/libadhocutil/lazyPointer.h b/libadhocutil/lazyPointer.h
index 5678642..bb41bc2 100644
--- a/libadhocutil/lazyPointer.h
+++ b/libadhocutil/lazyPointer.h
@@ -69,7 +69,6 @@ class LazyPointer {
[[nodiscard]] T * get() const
{
- // NOLINTNEXTLINE(hicpp-braces-around-statements)
if constexpr (std::is_pointer<P>::value) {
return deref();
}
diff --git a/libadhocutil/lexer-regex.cpp b/libadhocutil/lexer-regex.cpp
index dfbf9eb..669bd16 100644
--- a/libadhocutil/lexer-regex.cpp
+++ b/libadhocutil/lexer-regex.cpp
@@ -1,82 +1,79 @@
#include "lexer-regex.h"
-// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
-namespace AdHoc {
- namespace LexerMatchers {
- class Regex : public Lexer::Pattern {
- public:
- Regex(const Glib::ustring & pattern, GRegexCompileFlags compile, GRegexMatchFlags match) :
- err(nullptr),
- regex(g_regex_new(pattern.c_str(), compile, match, &err)),
- info(nullptr),
- str(nullptr)
- {
- if (!regex) {
- auto msg = std::string("Failed to create GRegex: ") + err->message;
- g_error_free(err);
- throw std::runtime_error(msg);
- }
+namespace AdHoc::LexerMatchers {
+ class Regex : public Lexer::Pattern {
+ public:
+ Regex(const Glib::ustring & pattern, GRegexCompileFlags compile, GRegexMatchFlags match) :
+ err(nullptr),
+ regex(g_regex_new(pattern.c_str(), compile, match, &err)),
+ info(nullptr),
+ str(nullptr)
+ {
+ if (!regex) {
+ auto msg = std::string("Failed to create GRegex: ") + err->message;
+ g_error_free(err);
+ throw std::runtime_error(msg);
}
+ }
- SPECIAL_MEMBERS_DELETE(Regex);
+ SPECIAL_MEMBERS_DELETE(Regex);
- ~Regex() override
- {
- if (err) {
- g_error_free(err);
- }
- if (info) {
- g_match_info_free(info);
- }
- g_regex_unref(regex);
+ ~Regex() override
+ {
+ if (err) {
+ g_error_free(err);
}
-
- bool matches(const gchar * string, size_t length, size_t position) const override
- {
- if (info) {
- g_match_info_free(info);
- }
- g_regex_match_full(regex, string, length, position, G_REGEX_MATCH_ANCHORED, &info, &err);
- if (err) {
- auto msg = std::string("Failed to create GRegex: ") + err->message;
- g_error_free(err);
- throw std::runtime_error(msg);
- }
- str = string;
- return g_match_info_matches(info);
+ if (info) {
+ g_match_info_free(info);
}
+ g_regex_unref(regex);
+ }
- size_t matchedLength() const override
- {
- gint start, end;
- g_match_info_fetch_pos(info, 0, &start, &end);
- return end - start;
+ bool matches(const gchar * string, size_t length, size_t position) const override
+ {
+ if (info) {
+ g_match_info_free(info);
}
+ g_regex_match_full(regex, string, length, position, G_REGEX_MATCH_ANCHORED, &info, &err);
+ if (err) {
+ auto msg = std::string("Failed to create GRegex: ") + err->message;
+ g_error_free(err);
+ throw std::runtime_error(msg);
+ }
+ str = string;
+ return g_match_info_matches(info);
+ }
+
+ size_t matchedLength() const override
+ {
+ gint start, end;
+ g_match_info_fetch_pos(info, 0, &start, &end);
+ return end - start;
+ }
- std::optional<Glib::ustring> match(int n) const override
- {
- gint start, end;
- if (g_match_info_fetch_pos(info, n, &start, &end)) {
- if (start == -1 && end == -1) {
- return {};
- }
- return Glib::ustring(str + start, str + end);
+ std::optional<Glib::ustring> match(int n) const override
+ {
+ gint start, end;
+ if (g_match_info_fetch_pos(info, n, &start, &end)) {
+ if (start == -1 && end == -1) {
+ return {};
}
- return {};
+ return Glib::ustring(str + start, str + end);
}
+ return {};
+ }
- private:
- mutable GError * err;
- GRegex * regex;
- mutable GMatchInfo * info;
- mutable const gchar * str;
- };
+ private:
+ mutable GError * err;
+ GRegex * regex;
+ mutable GMatchInfo * info;
+ mutable const gchar * str;
+ };
- Lexer::PatternPtr
- regex(const Glib::ustring & pattern, GRegexCompileFlags compile, GRegexMatchFlags match)
- {
- return std::make_shared<Regex>(pattern, compile, match);
- }
+ Lexer::PatternPtr
+ regex(const Glib::ustring & pattern, GRegexCompileFlags compile, GRegexMatchFlags match)
+ {
+ return std::make_shared<Regex>(pattern, compile, match);
}
}
diff --git a/libadhocutil/runtimeContext.cpp b/libadhocutil/runtimeContext.cpp
index 9c55e2d..ba3e2f9 100644
--- a/libadhocutil/runtimeContext.cpp
+++ b/libadhocutil/runtimeContext.cpp
@@ -3,9 +3,7 @@
#include <cstring>
#include <sys.h>
-// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
-namespace AdHoc {
-namespace System {
+namespace AdHoc::System {
RuntimeContext::RuntimeContext(size_t stacksize) :
stack(stacksize)
@@ -47,5 +45,4 @@ RuntimeContext::callbackWrapper(RuntimeContext * rc)
}
}
-}
diff --git a/libadhocutil/unittests/testCompileTimeFormatter.cpp b/libadhocutil/unittests/testCompileTimeFormatter.cpp
index 3347b5c..a19e588 100644
--- a/libadhocutil/unittests/testCompileTimeFormatter.cpp
+++ b/libadhocutil/unittests/testCompileTimeFormatter.cpp
@@ -4,6 +4,7 @@
#include <compileTimeFormatter.h>
#include <fileUtils.h>
#include <definedDirs.h>
+#include "memstream.h"
#include <filesystem>
@@ -298,17 +299,11 @@ operator<<(FILE & strm, const char * const p)
BOOST_AUTO_TEST_CASE( filestar )
{
- char * buf = nullptr;
- size_t len = 0;
- FILE * strm = open_memstream(&buf, &len);
- BOOST_REQUIRE(strm);
+ MemStream strm;
// NOLINTNEXTLINE(misc-non-copyable-objects)
- Formatter<formatStringMulti>::write(*strm, "file", "star");
- fclose(strm);
- BOOST_CHECK_EQUAL(len, 22);
- BOOST_CHECK_EQUAL(buf, "First file, then star.");
- // NOLINTNEXTLINE(hicpp-no-malloc)
- free(buf);
+ Formatter<formatStringMulti>::write(*strm.operator FILE *(), "file", "star");
+ BOOST_CHECK_EQUAL(strm.length(), 22);
+ BOOST_CHECK_EQUAL(strm.sv(), "First file, then star.");
}
#include "ctf-impl/printf-compat.h"
diff --git a/libadhocutil/unittests/testCurl.cpp b/libadhocutil/unittests/testCurl.cpp
index c5f0690..977bbfd 100644
--- a/libadhocutil/unittests/testCurl.cpp
+++ b/libadhocutil/unittests/testCurl.cpp
@@ -20,7 +20,9 @@ discard(void *, size_t sz, size_t nm, void *)
}
AdHocFormatter(FileUrl, "file://%?/%?");
-const auto urlGen = std::bind((std::string(*)(const std::string &, const std::string_view &))&FileUrl::get, rootDir, std::placeholders::_1);
+const auto urlGen = [](const std::string_view & url) {
+ return FileUrl::get(rootDir.string(), url);
+};
BOOST_AUTO_TEST_CASE( fetch_file )
{
@@ -125,11 +127,11 @@ BOOST_AUTO_TEST_CASE( fetch_multi )
CurlMultiHandle cmh;
std::map<std::string, std::string> files;
cmh.addCurl(urlGen("/testBuffer.cpp"),
- std::bind(&mapFileToName, std::ref(files), "testBuffer.cpp", _1));
+ [&files](auto && PH1) { return mapFileToName(files, "testBuffer.cpp", PH1); });
cmh.addCurl(urlGen("/testCurl.cpp"),
- std::bind(&mapFileToName, std::ref(files), "testCurl.cpp", _1));
+ [&files](auto && PH1) { return mapFileToName(files, "testCurl.cpp", PH1); });
cmh.addCurl(urlGen("/testLocks.cpp"),
- std::bind(&mapFileToName, std::ref(files), "testLocks.cpp", _1));
+ [&files](auto && PH1) { return mapFileToName(files, "testLocks.cpp", PH1); });
cmh.performAll();
BOOST_REQUIRE_EQUAL(3, files.size());
BOOST_REQUIRE_EQUAL("Locks", files["testLocks.cpp"]);
diff --git a/libadhocutil/unittests/testLazyPointer.cpp b/libadhocutil/unittests/testLazyPointer.cpp
index ff0b4df..1709742 100644
--- a/libadhocutil/unittests/testLazyPointer.cpp
+++ b/libadhocutil/unittests/testLazyPointer.cpp
@@ -38,7 +38,7 @@ paramFactory(const std::string & str)
BOOST_AUTO_TEST_CASE ( islazy )
{
- TestLazyPointer p(std::bind(&factory));
+ TestLazyPointer p([]{ return factory(); });
BOOST_REQUIRE_EQUAL(false, p.hasValue());
Test * t = p.get();
BOOST_REQUIRE(t);
@@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE ( reset )
p = nullptr;
BOOST_REQUIRE_EQUAL(true, p.hasValue());
BOOST_REQUIRE_EQUAL(true, !p);
- p = std::bind(&factory);
+ p = []{ return factory(); };
BOOST_REQUIRE_EQUAL(false, p.hasValue());
BOOST_REQUIRE(p.get());
BOOST_REQUIRE_EQUAL(true, p.hasValue());
@@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE ( reset )
BOOST_AUTO_TEST_CASE ( nondefault )
{
- TestLazyPointer p(std::bind(&paramFactory, "some string"));
+ TestLazyPointer p([]{ return paramFactory("some string"); });
BOOST_REQUIRE_EQUAL(false, p.hasValue());
BOOST_REQUIRE_EQUAL(11, (*p).val);
BOOST_REQUIRE_EQUAL(true, p.hasValue());
@@ -110,7 +110,7 @@ rawFactory(const std::string & s)
BOOST_AUTO_TEST_CASE( rawPointerFactory )
{
- RawLazyPointer value(std::bind(&rawFactory, std::string("four")));
+ RawLazyPointer value([]{ return rawFactory(std::string("four")); });
BOOST_REQUIRE(!value.hasValue());
BOOST_REQUIRE_EQUAL(*value, 4);
BOOST_REQUIRE(value.hasValue());