Skip to content

Instantly share code, notes, and snippets.

@allenh1
Last active November 7, 2018 16:07
Show Gist options
  • Select an option

  • Save allenh1/591606b29c658be420aedd1ff3d4e6fe to your computer and use it in GitHub Desktop.

Select an option

Save allenh1/591606b29c658be420aedd1ff3d4e6fe to your computer and use it in GitHub Desktop.
deboostify_bind_function.sh
#!/bin/bash
file_list=$(find src -name \*.h -print -o -name \*.cpp -print -o -name \*.inl -print)
((len=0))
for i in ${file_list}; do
((len=$len + 1))
done
echo "boost::bind -> std::bind..."
echo "boost::function -> std::function..."
echo "boost::ref -> std::ref..."
for i in ${file_list}; do
has_boost=$(grep "boost" $i)
if [[ -z "${has_boost}" ]]; then
((x=x+1))
continue
fi
sed -b -i -E -r -e 's/boost::bind/std::bind/g' $i
sed -b -i -E -r -e 's/boost::function/std::function/g' $i
sed -b -i -E -r -e 's/boost::ref/std::ref/g' $i
sed -b -i -E -r -e 's/, _([0-9])/, std::placeholders::_\1/g' $i
sed -b -i -E -r -e '/boost\/bind.hpp/d' $i
sed -b -i -E -r -e 's/boost\/function.hpp/functional/g' $i
((status = 100 * x / len))
((x=x+1))
echo "modifying '$i', ($status %)..."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment