Attached is a diff that might be useful to somebody who wants to compile 
ledger against boost 1.58, or on a mac. I don't know whether my changes 
were necessary because of the different version of boost or because I'm 
using apple's C compiler, or maybe it's the combination of the two. Anyway, 
I just kept tweaking things until the errors went away and I got to 
something that compiled (and appears to work against my existing ledger 
files). Unsurprisingly, some of the changes were related to the same 
sections I had to touch when I added boost 1.56 compatibility last year 
(https://github.com/ledger/ledger/commit/d5592ea1e325131d4a7abf5e98f67fcb5cf22287).
 
I have no idea if these changes are correct or helpful, but I figured I'd 
share them -- don't commit them into ledger without thinking about stuff, 
though, I was just madly hacking away at things until it all happened to 
finally compile. :)

Thanks for ledger, it really is amazing. I hope this diff ends up being 
useful to somebody.

Cheers,
Joe

----

I've got boost @1.58.0_1 installed via macports, and my gcc --version 
output is:

joegallo@epicac:~ $ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix

Here's the output of ./acprep update (I've elided the actual compilation, 
it works, but there's a bunch of warnings).

joegallo@epicac:~/Code/ledger $ ./acprep update
acprep: INFO: Invoking primary phase: update
acprep: INFO: Executing phase: update
acprep: INFO: Executing phase: pull
Already up-to-date.
acprep: INFO: Executing phase: submodule
acprep: INFO: Executing phase: make
acprep: INFO: Executing phase: config
acprep: INFO: Executing phase: submodule
acprep: INFO: Executing phase: configure
acprep: INFO: System type is => Darwin
acprep: INFO: Setting up build flavor => debug
-- The C compiler identification is AppleClang 6.1.0.6020049
-- The CXX compiler identification is AppleClang 6.1.0.6020049
-- Check for working C compiler: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
 
-- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: 
/Applications/Xcode.app/Contents/Developer/usr/bin/g++
-- Check for working CXX compiler: 
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /opt/local/bin/python2.7 (found version "2.7.9")
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   date_time
--   filesystem
--   system
--   iostreams
--   regex
--   unit_test_framework
-- Looking for access
-- Looking for access - found
-- Looking for realpath
-- Looking for realpath - found
-- Looking for getpwuid
-- Looking for getpwuid - found
-- Looking for getpwnam
-- Looking for getpwnam - found
-- Looking for ioctl
-- Looking for ioctl - found
-- Looking for isatty
-- Looking for isatty - found
-- Performing Test UNIX_PIPES_COMPILES
-- Performing Test UNIX_PIPES_COMPILES - Success
-- Performing Test BOOST_REGEX_UNICODE_RUNS
-- Performing Test BOOST_REGEX_UNICODE_RUNS - Failed
-- Looking for readline in edit
-- Looking for readline in edit - found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/joegallo/Code/ledger

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/account.h b/src/account.h
index 76e839e..0b55ce9 100644
--- a/src/account.h
+++ b/src/account.h
@@ -261,11 +261,7 @@ public:
   mutable optional<xdata_t> xdata_;
 
   bool has_xdata() const {
-#if BOOST_VERSION >= 105600
-    return xdata_ != NULL;
-#else
-    return xdata_;
-#endif
+      return !!(xdata_);
   }
   void clear_xdata();
   xdata_t& xdata() {
diff --git a/src/filters.cc b/src/filters.cc
index 2f97a0e..b6530c0 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -707,7 +707,7 @@ namespace {
     insert_prices_in_map(price_map_t& _all_prices)
       : all_prices(_all_prices) {}
 
-    void operator()(datetime_t& date, const amount_t& price) {
+    void operator()(const datetime_t& date, const amount_t& price) {
       all_prices.insert(price_map_t::value_type(date, price));
     }
   };
diff --git a/src/item.h b/src/item.h
index 458cb37..aa55e41 100644
--- a/src/item.h
+++ b/src/item.h
@@ -191,11 +191,7 @@ public:
   static bool use_aux_date;
 
   virtual bool has_date() const {
-#if BOOST_VERSION >= 105600
-    return _date != NULL;
-#else
-    return _date;
-#endif
+      return !!(_date);
   }
 
   virtual date_t date() const {
diff --git a/src/iterators.cc b/src/iterators.cc
index 21bec5d..0225e21 100644
--- a/src/iterators.cc
+++ b/src/iterators.cc
@@ -96,7 +96,7 @@ namespace {
       TRACE_DTOR(create_price_xact);
     }
 
-    void operator()(datetime_t& date, const amount_t& price) {
+    void operator()(const datetime_t& date, const amount_t& price) {
       xact_t * xact;
       string   symbol = price.commodity().symbol();
 
diff --git a/src/parser.h b/src/parser.h
index e46fc71..25c4a7e 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -118,7 +118,7 @@ public:
 
   ptr_op_t parse(std::istream&           in,
                  const parse_flags_t&    flags           = PARSE_DEFAULT,
-                 const optional<string>& original_string = NULL);
+                 const optional<string>& original_string = boost::none);
 };
 
 } // namespace ledger
diff --git a/src/post.h b/src/post.h
index 1e5fc56..7796293 100644
--- a/src/post.h
+++ b/src/post.h
@@ -205,11 +205,7 @@ public:
   mutable optional<xdata_t> xdata_;
 
   bool has_xdata() const {
-#if BOOST_VERSION >= 105600
-    return xdata_ != NULL;
-#else
-    return xdata_;
-#endif
+      return !!(xdata_);
   }
   void clear_xdata() {
     xdata_ = none;
diff --git a/src/times.h b/src/times.h
index c1bfb1c..0cb05ff 100644
--- a/src/times.h
+++ b/src/times.h
@@ -568,11 +568,7 @@ public:
   void   stabilize(const optional<date_t>& date = none);
 
   bool   is_valid() const {
-#if BOOST_VERSION >= 105600
-    return start != NULL;
-#else
-    return start;
-#endif
+      return !!(start);
   }
 
   /** Find the current or next period containing date.  Returns false if

Reply via email to