Skip to content

Commit

Permalink
Remove uses of Boost.Function (#213)
Browse files Browse the repository at this point in the history
Remove uses of boost::mem_fn (missing from Bind.Bind removal in #212).
  • Loading branch information
mloskot authored Jan 13, 2019
1 parent 78b7dcf commit da6acc6
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ before_build:
- git submodule --quiet update --init tools/boost_install
- git submodule --quiet update --init tools/boostdep
- git submodule --quiet update --init libs/headers
## Direct
## Direct (of GIL headers only)
- git submodule --quiet update --init libs/algorithm
- git submodule --quiet update --init libs/array
- git submodule --quiet update --init libs/assert
Expand All @@ -87,15 +87,14 @@ before_build:
- git submodule --quiet update --init libs/core
- git submodule --quiet update --init libs/crc
- git submodule --quiet update --init libs/filesystem
- git submodule --quiet update --init libs/function
- git submodule --quiet update --init libs/integer
- git submodule --quiet update --init libs/iterator
- git submodule --quiet update --init libs/mpl
- git submodule --quiet update --init libs/numeric/conversion
- git submodule --quiet update --init libs/preprocessor
- git submodule --quiet update --init libs/test
- git submodule --quiet update --init libs/type_traits
## Transitive
## Transitive (of GIL tests too)
- git submodule --quiet update --init libs/atomic
- git submodule --quiet update --init libs/bind
- git submodule --quiet update --init libs/chrono
Expand All @@ -104,6 +103,7 @@ before_build:
- git submodule --quiet update --init libs/conversion
- git submodule --quiet update --init libs/detail
- git submodule --quiet update --init libs/exception
- git submodule --quiet update --init libs/function
- git submodule --quiet update --init libs/function_types
- git submodule --quiet update --init libs/fusion
- git submodule --quiet update --init libs/intrusive
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ install:
- git submodule --quiet update --init tools/boost_install
- git submodule --quiet update --init tools/boostdep
- git submodule --quiet update --init libs/headers
## Direct
## Direct (of GIL headers only)
- git submodule --quiet update --init libs/algorithm
- git submodule --quiet update --init libs/assert
- git submodule --quiet update --init libs/array
Expand All @@ -206,15 +206,14 @@ install:
- git submodule --quiet update --init libs/core
- git submodule --quiet update --init libs/crc
- git submodule --quiet update --init libs/filesystem
- git submodule --quiet update --init libs/function
- git submodule --quiet update --init libs/integer
- git submodule --quiet update --init libs/iterator
- git submodule --quiet update --init libs/mpl
- git submodule --quiet update --init libs/numeric/conversion
- git submodule --quiet update --init libs/preprocessor
- git submodule --quiet update --init libs/test
- git submodule --quiet update --init libs/type_traits
## Transitive
## Transitive (of GIL tests too)
- git submodule --quiet update --init libs/atomic
- git submodule --quiet update --init libs/bind
- git submodule --quiet update --init libs/chrono
Expand All @@ -223,6 +222,7 @@ install:
- git submodule --quiet update --init libs/conversion
- git submodule --quiet update --init libs/detail
- git submodule --quiet update --init libs/exception
- git submodule --quiet update --init libs/function
- git submodule --quiet update --init libs/function_types
- git submodule --quiet update --init libs/fusion
- git submodule --quiet update --init libs/intrusive
Expand Down
17 changes: 8 additions & 9 deletions include/boost/gil/extension/io/bmp/detail/scanline_read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include <boost/gil/io/scanline_read_iterator.hpp>
#include <boost/gil/io/typedefs.hpp>

#include <boost/function.hpp>

#include <functional>
#include <type_traits>
#include <vector>

Expand Down Expand Up @@ -122,7 +121,7 @@ class scanline_reader< Device
read_palette();
_buffer.resize( _pitch );

_read_function = boost::mem_fn( &this_t::read_1_bit_row );
_read_function = std::mem_fn(&this_t::read_1_bit_row);

break;
}
Expand All @@ -145,7 +144,7 @@ class scanline_reader< Device
read_palette();
_buffer.resize( _pitch );

_read_function = boost::mem_fn( &this_t::read_4_bits_row );
_read_function = std::mem_fn(&this_t::read_4_bits_row);

break;
}
Expand Down Expand Up @@ -176,7 +175,7 @@ class scanline_reader< Device
read_palette();
_buffer.resize( _pitch );

_read_function = boost::mem_fn( &this_t::read_8_bits_row );
_read_function = std::mem_fn(&this_t::read_8_bits_row);

break;
}
Expand Down Expand Up @@ -239,23 +238,23 @@ class scanline_reader< Device
}


_read_function = boost::mem_fn( &this_t::read_15_bits_row );
_read_function = std::mem_fn(&this_t::read_15_bits_row);

break;
}

case 24:
{
this->_scanline_length = ( this->_info._width * num_channels< rgb8_view_t >::value + 3 ) & ~3;
_read_function = boost::mem_fn( &this_t::read_row );
_read_function = std::mem_fn(&this_t::read_row);

break;
}

case 32:
{
this->_scanline_length = ( this->_info._width * num_channels< rgba8_view_t >::value + 3 ) & ~3;
_read_function = boost::mem_fn( &this_t::read_row );
_read_function = std::mem_fn(&this_t::read_row);

break;
}
Expand Down Expand Up @@ -406,7 +405,7 @@ class scanline_reader< Device
detail::mirror_bits <std::vector<byte_t>, std::true_type> _mirror_bits;
detail::swap_half_bytes<std::vector<byte_t>, std::true_type> _swap_half_bytes;

boost::function<void(this_t*, byte_t*)> _read_function;
std::function<void(this_t*, byte_t*)> _read_function;
};

} // namespace gil
Expand Down
27 changes: 13 additions & 14 deletions include/boost/gil/extension/io/pnm/detail/scanline_read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include <boost/gil/io/scanline_read_iterator.hpp>
#include <boost/gil/io/typedefs.hpp>

#include <boost/function.hpp>

#include <functional>
#include <type_traits>
#include <vector>

Expand Down Expand Up @@ -86,8 +85,8 @@ class scanline_reader< Device
{
this->_scanline_length = this->_info._width;

_read_function = boost::mem_fn( &this_t::read_text_row );
_skip_function = boost::mem_fn( &this_t::skip_text_row );
_read_function = std::mem_fn(&this_t::read_text_row);
_skip_function = std::mem_fn(&this_t::skip_text_row);

break;
}
Expand All @@ -96,8 +95,8 @@ class scanline_reader< Device
{
this->_scanline_length = this->_info._width * num_channels< rgb8_view_t >::value;

_read_function = boost::mem_fn( &this_t::read_text_row );
_skip_function = boost::mem_fn( &this_t::skip_text_row );
_read_function = std::mem_fn(&this_t::read_text_row);
_skip_function = std::mem_fn(&this_t::skip_text_row);

break;
}
Expand All @@ -108,8 +107,8 @@ class scanline_reader< Device
//gray1_image_t
this->_scanline_length = ( this->_info._width + 7 ) >> 3;

_read_function = boost::mem_fn( &this_t::read_binary_bit_row );
_skip_function = boost::mem_fn( &this_t::skip_binary_row );
_read_function = std::mem_fn(&this_t::read_binary_bit_row);
_skip_function = std::mem_fn(&this_t::skip_binary_row);

break;
}
Expand All @@ -119,8 +118,8 @@ class scanline_reader< Device
// gray8_image_t
this->_scanline_length = this->_info._width;

_read_function = boost::mem_fn( &this_t::read_binary_byte_row );
_skip_function = boost::mem_fn( &this_t::skip_binary_row );
_read_function = std::mem_fn(&this_t::read_binary_byte_row);
_skip_function = std::mem_fn(&this_t::skip_binary_row);

break;
}
Expand All @@ -130,8 +129,8 @@ class scanline_reader< Device
// rgb8_image_t
this->_scanline_length = this->_info._width * num_channels< rgb8_view_t >::value;

_read_function = boost::mem_fn( &this_t::read_binary_byte_row );
_skip_function = boost::mem_fn( &this_t::skip_binary_row );
_read_function = std::mem_fn(&this_t::read_binary_byte_row);
_skip_function = std::mem_fn(&this_t::skip_binary_row);

break;
}
Expand Down Expand Up @@ -236,8 +235,8 @@ class scanline_reader< Device
detail::negate_bits<std::vector<byte_t>, std::true_type> _negate_bits;
detail::swap_half_bytes<std::vector<byte_t>, std::true_type> _swap_half_bytes;

boost::function<void(this_t*, byte_t*)> _read_function;
boost::function<void(this_t*)> _skip_function;
std::function<void(this_t*, byte_t*)> _read_function;
std::function<void(this_t*)> _skip_function;
};


Expand Down
27 changes: 13 additions & 14 deletions include/boost/gil/extension/io/tiff/detail/scanline_read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
#include <boost/gil/io/row_buffer_helper.hpp>
#include <boost/gil/io/scanline_read_iterator.hpp>

#include <boost/function.hpp>

#include <algorithm>
#include <functional>
#include <string>
#include <type_traits>
#include <vector>
Expand Down Expand Up @@ -122,7 +121,7 @@ class scanline_reader< Device
, sizeof(uint16_t) * num_colors
);

_read_function = boost::mem_fn( &this_t::read_1_bit_index_image );
_read_function = std::mem_fn(&this_t::read_1_bit_index_image);

break;
}
Expand All @@ -141,7 +140,7 @@ class scanline_reader< Device
, sizeof(uint16_t) * num_colors
);

_read_function = boost::mem_fn( &this_t::read_2_bits_index_image );
_read_function = std::mem_fn(&this_t::read_2_bits_index_image);

break;
}
Expand All @@ -159,7 +158,7 @@ class scanline_reader< Device
, sizeof(uint16_t) * num_colors
);

_read_function = boost::mem_fn( &this_t::read_4_bits_index_image );
_read_function = std::mem_fn(&this_t::read_4_bits_index_image);

break;
}
Expand All @@ -178,7 +177,7 @@ class scanline_reader< Device
, sizeof(uint16_t) * num_colors
);

_read_function = boost::mem_fn( &this_t::read_8_bits_index_image );
_read_function = std::mem_fn(&this_t::read_8_bits_index_image);

break;
}
Expand All @@ -197,7 +196,7 @@ class scanline_reader< Device
, sizeof(uint16_t) * num_colors
);

_read_function = boost::mem_fn( &this_t::read_16_bits_index_image );
_read_function = std::mem_fn(&this_t::read_16_bits_index_image);

break;
}
Expand All @@ -216,7 +215,7 @@ class scanline_reader< Device
, sizeof(uint16_t) * num_colors
);

_read_function = boost::mem_fn( &this_t::read_24_bits_index_image );
_read_function = std::mem_fn(&this_t::read_24_bits_index_image);

break;
}
Expand All @@ -235,7 +234,7 @@ class scanline_reader< Device
, sizeof(uint16_t) * num_colors
);

_read_function = boost::mem_fn( &this_t::read_32_bits_index_image );
_read_function = std::mem_fn(&this_t::read_32_bits_index_image);

break;
}
Expand Down Expand Up @@ -273,7 +272,7 @@ class scanline_reader< Device
case 14:
case 16:
case 24:
case 32: { _read_function = boost::mem_fn( &this_t::read_row ); break; }
case 32: { _read_function = std::mem_fn(&this_t::read_row); break; }
default: { io_error( "Image type is not supported." ); }
}

Expand All @@ -296,7 +295,7 @@ class scanline_reader< Device
case 14:
case 16:
case 24:
case 32: { _read_function = boost::mem_fn( &this_t::read_row ); break; }
case 32: { _read_function = std::mem_fn(&this_t::read_row); break; }
default: { io_error( "Image type is not supported." ); }
}

Expand All @@ -315,7 +314,7 @@ class scanline_reader< Device
case 14:
case 16:
case 24:
case 32: { _read_function = boost::mem_fn( &this_t::read_row ); break; }
case 32: { _read_function = std::mem_fn(&this_t::read_row); break; }
default: { io_error( "Image type is not supported." ); }
}

Expand All @@ -339,7 +338,7 @@ class scanline_reader< Device
case 14:
case 16:
case 24:
case 32: { _read_function = boost::mem_fn( &this_t::read_row ); break; }
case 32: { _read_function = std::mem_fn(&this_t::read_row); break; }
default: { io_error( "Image type is not supported." ); }
}

Expand Down Expand Up @@ -439,7 +438,7 @@ class scanline_reader< Device

std::vector< byte_t> _buffer;
detail::mirror_bits<std::vector<byte_t>, std::true_type> _mirror_bites;
boost::function<void(this_t*, byte_t*, int)> _read_function;
std::function<void(this_t*, byte_t*, int)> _read_function;
};

} // namespace gil
Expand Down

0 comments on commit da6acc6

Please sign in to comment.