id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11348,Problem constructing boost::iterator_range objects from arrays,graham@…,Neil Groves,"I'm migrating to boost 1.58.0 from an older version and have found that I'm no longer able to construct a boost::iterator_range directly from an array. The following code snippet demonstrates the problem: {{{ #!cpp #include int main() { int arr[] = { 1, 2 }; boost::iterator_range x = arr; } }}} Using gcc 4.9.2 on Linux with Boost 1.58.0, the following error is produced: {{{ foo.cpp: In function 'int main()': foo.cpp:5:38: error: conversion from 'int [2]' to non-scalar type 'boost::iterator_range' requested boost::iterator_range x = arr; ^ }}} The code compiles fine with older versions of Boost (e.g. 1.53.0). It appears that the problem was introduced with this change: https://github.com/boostorg/range/commit/7d13f63d5d1324abf519b67f59e1814b2cbe5d55 although I have not manually verified this. From my brief reading of the change introduced here, it seems to deem a type that is convertible to the base iterator type to not be a compatible range. In the example above, int[2] is convertible to int *, hence the constructor is excluded from consideration. It appears I can work around the problem by calling boost::make_iterator_range, but I would have to change quite a lot of code to use this workaround. Hence I wanted to verify that the previous behaviour was expected, and find out if a fix is possible. I'm happy to help work on a patch, for example perhaps the is_compatible_range check can be tightened to explicitly check for the array case. Thanks, Graham ",Bugs,new,To Be Determined,range,Boost 1.58.0,Regression,,,