lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] static_assert and :argdo [Was: Replacing boost with std C++11]


From: Greg Chicares
Subject: [lmi] static_assert and :argdo [Was: Replacing boost with std C++11]
Date: Tue, 10 Jan 2017 21:50:28 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.5.1

On 2017-01-09 16:49, Vadim Zeitlin wrote:
> On Mon, 9 Jan 2017 16:18:18 +0000 Greg Chicares <address@hidden> wrote:
[...]
> GC> I took a look at other lmi uses of boost, to see whether there's anything
> GC> else that's simple and mechanical. The first thing that occurred to me was
> GC> enable_if...
> 
>  FWIW the first thing that occurred to me was static_assert(), which has
> special compiler support and is just less ugly than BOOST_STATIC_ASSERT.

At the moment I want to ask only about editing. Consider:

vim --cmd "args *.?pp | argdo g/boost\/static_assert.hpp/d | 
%s/BOOST_STATIC_ASSERT/static_assert/g | update"

for z in *.?pp; do grep -q static_assert $z && sed -i $z 
-e'/boost\static_assert.hpp/d' -e's/BOOST_STATIC_ASSERT/static_assert/g'; done

I think I prefer the latter, with small tools in a pipeline: it can hardly
be plainer, and if I make a mistake, it's easier to figure out. OTOH, with
the vim command, I was kind of surprised that '|' worked the way I wanted, i.e.
  args *.?pp | argdo { g/boost\/static_assert.hpp/d | 
%s/BOOST_STATIC_ASSERT/static_assert/g | update }
using '{}' to show the hypothetical grouping.

Am I missing some hidden glory of vim that somehow makes this easier?

Of course I'll want to do
  vim --cmd "vim static_assert *.?pp"
next, to make context-dependent changes like this:

-    // Assert that the static_cast doesn't engender undefined behavior.
-    // Double parentheses: don't parse comma as a macro parameter separator.
     static_assert
-        ((
+        (
         std::is_base_of
             <MemberSymbolTable<ClassType>
             ,ClassType
             >::value
-        ));
+        );




reply via email to

[Prev in Thread] Current Thread [Next in Thread]