-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conflict with std::fill_n and boost::range::fill_n (Trac 7189)
Add minimal test for the std::fill and boost::array or std::array as pixel type.
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ project | |
; | ||
|
||
run for_each_pixel.cpp ; | ||
run std_fill.cpp ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Copyright 2018 Mateusz Loskot <mateusz at loskot dot net> | ||
// | ||
// Distributed under the Boost Software License, Version 1.0 | ||
// See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt | ||
// | ||
#include <boost/gil/algorithm.hpp> | ||
#include <boost/gil/image.hpp> | ||
#include <boost/gil/image_view.hpp> | ||
|
||
#include <boost/array.hpp> | ||
#include <boost/core/lightweight_test.hpp> | ||
#include <boost/range/algorithm/fill_n.hpp> | ||
|
||
#include <array> | ||
#include <cstdint> | ||
|
||
namespace gil = boost::gil; | ||
|
||
template <typename ArrayPixel> | ||
void test_array_as_range() | ||
{ | ||
static_assert(ArrayPixel().size() == 2, "two-element array expected"); | ||
|
||
gil::image<ArrayPixel> img(1, 1); | ||
std::fill(gil::view(img).begin(), gil::view(img).end(), ArrayPixel{0, 1}); | ||
BOOST_TEST(*gil::view(img).at(0,0) == (ArrayPixel{0, 1})); | ||
} | ||
|
||
int main() | ||
{ | ||
test_array_as_range<boost::array<int, 2>>(); | ||
test_array_as_range<std::array<int, 2>>(); | ||
|
||
return boost::report_errors(); | ||
} |